-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added zap logger to NewEnvironment to be used in scytale
- Loading branch information
1 parent
e4844ac
commit 983f6ba
Showing
13 changed files
with
162 additions
and
222 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package adapter | ||
|
||
import "go.uber.org/zap" | ||
|
||
type Adapter struct { | ||
*zap.Logger | ||
} | ||
|
||
// this method makes Adapter implement log.Logger | ||
func (a Adapter) Log(keyvals ...interface{}) error { | ||
fields := make([]zap.Field, 0, len(keyvals)/2) | ||
for i, j := 0, 0; j < len(keyvals); i, j = i+1, j+1 { | ||
fields = append(fields, zap.Any(keyvals[i].(string), keyvals[j])) | ||
} | ||
|
||
// ignore the case where there's an odd number of keyvals ... that would be a bug | ||
// and we're deprecating webpa-common anyway | ||
|
||
a.Logger.Info("", fields...) | ||
return nil | ||
} |
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
Oops, something went wrong.