Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
  • Loading branch information
Kubuxu committed Jul 8, 2019
1 parent 499a327 commit 9c9fd61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 1 addition & 4 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,9 @@ type EventLogger interface {

// Logger retrieves an event logger by name
func Logger(system string) *eventLogger {

// TODO if we would like to adjust log levels at run-time. Store this event
// logger in a map (just like the util.Logger impl)
if len(system) == 0 {
setuplog := getLogger("setup-logger")
setuplog.Warn("Missing name parameter")
setuplog.Error("Missing name parameter")
system = "undefined"
}

Expand Down
14 changes: 8 additions & 6 deletions oldlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,18 @@ var zapCfg = zap.NewProductionConfig()
func SetupLogging() {

// colorful or plain

color := os.Getenv(envLoggingFmt) != "nocolor"
if color {
zapCfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
} else {
switch os.Getenv(envLoggingFmt) {
case "nocolor":
zapCfg.Encoding = "console"
zapCfg.EncoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder
case "json":
zapCfg.Encoding = "json"
default:
zapCfg.Encoding = "console"
zapCfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
}

zapCfg.Sampling = nil
zapCfg.Encoding = "console"
zapCfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder

zapCfg.OutputPaths = []string{"stderr"}
Expand Down

0 comments on commit 9c9fd61

Please sign in to comment.