diff --git a/backend/log/log.go b/backend/log/log.go index 9c9f03cfb..e23185a9b 100644 --- a/backend/log/log.go +++ b/backend/log/log.go @@ -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 } @@ -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()