-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from checkr/zz/add-context-logging
Add more context logging
- Loading branch information
Showing
8 changed files
with
86 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
- key: test_kafka_2 | ||
- key: test_kafka_payload_file | ||
kind: Behavior | ||
expect: | ||
kafka: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package openmock | ||
|
||
import "github.com/sirupsen/logrus" | ||
|
||
type omLogger struct { | ||
*logrus.Entry | ||
ctx Context | ||
} | ||
|
||
func newOmLogger(ctx Context) *omLogger { | ||
currentMock := &Mock{} | ||
if ctx.currentMock != nil { | ||
currentMock = ctx.currentMock | ||
} | ||
entry := logrus.NewEntry(logrus.StandardLogger()).WithFields(logrus.Fields{ | ||
"current_mock_key": currentMock.Key, | ||
}) | ||
return &omLogger{ | ||
Entry: entry, | ||
ctx: ctx, | ||
} | ||
} | ||
|
||
func (l *omLogger) SetPrefix(prefix string) { | ||
l.Entry = l.Entry.WithFields(logrus.Fields{"logger_prefix": prefix}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters