Skip to content

Commit

Permalink
adding With in logger interface/implementation (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferruvich committed Dec 14, 2022
1 parent cb6cd94 commit 66b268d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backend/log/log.go
Expand Up @@ -22,6 +22,7 @@ type Logger interface {
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
With(args ...interface{}) Logger
Level() Level
}

Expand Down Expand Up @@ -82,5 +83,12 @@ func (l *hclogWrapper) Level() Level {
return NoLevel
}

// With creates a sub-logger that will always have the given key/value pairs.
func (l *hclogWrapper) With(args ...interface{}) Logger {
return &hclogWrapper{
logger: l.logger.With(args...),
}
}

// DefaultLogger is the default logger.
var DefaultLogger = New()

0 comments on commit 66b268d

Please sign in to comment.