@@ -70,15 +70,15 @@ func (logctx *LogContext) AddField(key string, value interface{}) *LogContext {
70
70
return logctx
71
71
}
72
72
73
- // Logger retrieves the native logger interface. Use with care.
73
+ // Log retrieves the native logger interface. Use with care.
74
74
func Log () * logrus.Logger {
75
75
return logger
76
76
}
77
77
78
78
// Tracef logs a debug message for logctx to stdout
79
79
func (logctx * LogContext ) Tracef (format string , args ... interface {}) {
80
80
logger .SetOutput (logctx .normalOut )
81
- if logctx . fields != nil && len (logctx .fields ) > 0 {
81
+ if len (logctx .fields ) > 0 {
82
82
logger .WithFields (logctx .fields ).Tracef (format , args ... )
83
83
} else {
84
84
logger .Tracef (format , args ... )
@@ -88,7 +88,7 @@ func (logctx *LogContext) Tracef(format string, args ...interface{}) {
88
88
// Debugf logs a debug message for logctx to stdout
89
89
func (logctx * LogContext ) Debugf (format string , args ... interface {}) {
90
90
logger .SetOutput (logctx .normalOut )
91
- if logctx . fields != nil && len (logctx .fields ) > 0 {
91
+ if len (logctx .fields ) > 0 {
92
92
logger .WithFields (logctx .fields ).Debugf (format , args ... )
93
93
} else {
94
94
logger .Debugf (format , args ... )
@@ -98,7 +98,7 @@ func (logctx *LogContext) Debugf(format string, args ...interface{}) {
98
98
// Infof logs an informational message for logctx to stdout
99
99
func (logctx * LogContext ) Infof (format string , args ... interface {}) {
100
100
logger .SetOutput (logctx .normalOut )
101
- if logctx . fields != nil && len (logctx .fields ) > 0 {
101
+ if len (logctx .fields ) > 0 {
102
102
logger .WithFields (logctx .fields ).Infof (format , args ... )
103
103
} else {
104
104
logger .Infof (format , args ... )
@@ -108,7 +108,7 @@ func (logctx *LogContext) Infof(format string, args ...interface{}) {
108
108
// Warnf logs a warning message for logctx to stdout
109
109
func (logctx * LogContext ) Warnf (format string , args ... interface {}) {
110
110
logger .SetOutput (logctx .normalOut )
111
- if logctx . fields != nil && len (logctx .fields ) > 0 {
111
+ if len (logctx .fields ) > 0 {
112
112
logger .WithFields (logctx .fields ).Warnf (format , args ... )
113
113
} else {
114
114
logger .Warnf (format , args ... )
@@ -118,7 +118,7 @@ func (logctx *LogContext) Warnf(format string, args ...interface{}) {
118
118
// Errorf logs a non-fatal error message for logctx to stdout
119
119
func (logctx * LogContext ) Errorf (format string , args ... interface {}) {
120
120
logger .SetOutput (logctx .errorOut )
121
- if logctx . fields != nil && len (logctx .fields ) > 0 {
121
+ if len (logctx .fields ) > 0 {
122
122
logger .WithFields (logctx .fields ).Errorf (format , args ... )
123
123
} else {
124
124
logger .Errorf (format , args ... )
@@ -128,14 +128,14 @@ func (logctx *LogContext) Errorf(format string, args ...interface{}) {
128
128
// Fatalf logs a fatal error message for logctx to stdout
129
129
func (logctx * LogContext ) Fatalf (format string , args ... interface {}) {
130
130
logger .SetOutput (logctx .errorOut )
131
- if logctx . fields != nil && len (logctx .fields ) > 0 {
131
+ if len (logctx .fields ) > 0 {
132
132
logger .WithFields (logctx .fields ).Fatalf (format , args ... )
133
133
} else {
134
134
logger .Fatalf (format , args ... )
135
135
}
136
136
}
137
137
138
- // Debugf logs a warning message without context to stdout
138
+ // Tracef logs a warning message without context to stdout
139
139
func Tracef (format string , args ... interface {}) {
140
140
logCtx := NewContext ()
141
141
logCtx .Tracef (format , args ... )
0 commit comments