diff --git a/ext/git/writer.go b/ext/git/writer.go index d2d2f75b..f286f51c 100644 --- a/ext/git/writer.go +++ b/ext/git/writer.go @@ -61,7 +61,7 @@ func (m *nativeGitClient) Commit(pathSpec string, opts *CommitOptions) error { out, err := m.runCmd(args...) if err != nil { - log.Errorf(out) + log.Errorf("%s %v", out, err) return err } diff --git a/pkg/log/log.go b/pkg/log/log.go index 1f746340..85be5d40 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...)