diff options
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/log/log.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/log/log.go b/pkg/log/log.go index 1f74634..85be5d4 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -70,7 +70,7 @@ func (logctx *LogContext) AddField(key string, value interface{}) *LogContext { return logctx } -// Logger retrieves the native logger interface. Use with care. +// Log retrieves the native logger interface. Use with care. func Log() *logrus.Logger { return logger } @@ -78,7 +78,7 @@ func Log() *logrus.Logger { // Tracef logs a debug message for logctx to stdout func (logctx *LogContext) Tracef(format string, args ...interface{}) { logger.SetOutput(logctx.normalOut) - if logctx.fields != nil && len(logctx.fields) > 0 { + if len(logctx.fields) > 0 { logger.WithFields(logctx.fields).Tracef(format, args...) } else { logger.Tracef(format, args...) @@ -88,7 +88,7 @@ func (logctx *LogContext) Tracef(format string, args ...interface{}) { // Debugf logs a debug message for logctx to stdout func (logctx *LogContext) Debugf(format string, args ...interface{}) { logger.SetOutput(logctx.normalOut) - if logctx.fields != nil && len(logctx.fields) > 0 { + if len(logctx.fields) > 0 { logger.WithFields(logctx.fields).Debugf(format, args...) } else { logger.Debugf(format, args...) @@ -98,7 +98,7 @@ func (logctx *LogContext) Debugf(format string, args ...interface{}) { // Infof logs an informational message for logctx to stdout func (logctx *LogContext) Infof(format string, args ...interface{}) { logger.SetOutput(logctx.normalOut) - if logctx.fields != nil && len(logctx.fields) > 0 { + if len(logctx.fields) > 0 { logger.WithFields(logctx.fields).Infof(format, args...) } else { logger.Infof(format, args...) @@ -108,7 +108,7 @@ func (logctx *LogContext) Infof(format string, args ...interface{}) { // Warnf logs a warning message for logctx to stdout func (logctx *LogContext) Warnf(format string, args ...interface{}) { logger.SetOutput(logctx.normalOut) - if logctx.fields != nil && len(logctx.fields) > 0 { + if len(logctx.fields) > 0 { logger.WithFields(logctx.fields).Warnf(format, args...) } else { logger.Warnf(format, args...) @@ -118,7 +118,7 @@ func (logctx *LogContext) Warnf(format string, args ...interface{}) { // Errorf logs a non-fatal error message for logctx to stdout func (logctx *LogContext) Errorf(format string, args ...interface{}) { logger.SetOutput(logctx.errorOut) - if logctx.fields != nil && len(logctx.fields) > 0 { + if len(logctx.fields) > 0 { logger.WithFields(logctx.fields).Errorf(format, args...) } else { logger.Errorf(format, args...) @@ -128,14 +128,14 @@ func (logctx *LogContext) Errorf(format string, args ...interface{}) { // Fatalf logs a fatal error message for logctx to stdout func (logctx *LogContext) Fatalf(format string, args ...interface{}) { logger.SetOutput(logctx.errorOut) - if logctx.fields != nil && len(logctx.fields) > 0 { + if len(logctx.fields) > 0 { logger.WithFields(logctx.fields).Fatalf(format, args...) } else { logger.Fatalf(format, args...) } } -// Debugf logs a warning message without context to stdout +// Tracef logs a warning message without context to stdout func Tracef(format string, args ...interface{}) { logCtx := NewContext() logCtx.Tracef(format, args...) |
