Skip to content

Commit

Permalink
[LOGGER] Add debug flag for default
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytten committed Feb 21, 2021
1 parent 3aa633e commit 71c4d83
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions default.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ import (
)

type defaultLogger struct {
debug bool
}

func NewDefault() Logger {
return &defaultLogger{}
func NewDefault(debug bool) Logger {
return &defaultLogger{debug: debug}
}

func (*defaultLogger) Debug(msg string, metadata map[string]interface{}) {
log.Printf("[DEBUG] %s %#v", msg, metadata)
func (l *defaultLogger) Debug(msg string, metadata map[string]interface{}) {
if l.debug {
log.Printf("[DEBUG] %s %#v", msg, metadata)
}
}

func (*defaultLogger) Info(msg string, metadata map[string]interface{}) {
Expand Down

0 comments on commit 71c4d83

Please sign in to comment.