Skip to content

Commit 56a3eb9

Browse files
committed
clean: refactoring
1 parent 8cb5e39 commit 56a3eb9

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

stackdriver.go

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -118,152 +118,152 @@ func RequestContextLogger(r *http.Request) *ContextLogger {
118118

119119
// Default logs a message at DEFAULT severity
120120
func (l *ContextLogger) Default(args ...interface{}) {
121-
l.write(SeverityDefault, fmt.Sprint(args...))
121+
_ = l.write(SeverityDefault, fmt.Sprint(args...))
122122
}
123123

124124
// Defaultf logs a message at DEFAULT severity
125125
func (l *ContextLogger) Defaultf(format string, args ...interface{}) {
126-
l.write(SeverityDefault, fmt.Sprintf(format, args...))
126+
_ = l.write(SeverityDefault, fmt.Sprintf(format, args...))
127127
}
128128

129129
// Defaultln logs a message at DEFAULT severity
130130
func (l *ContextLogger) Defaultln(args ...interface{}) {
131-
l.write(SeverityDefault, fmt.Sprintln(args...))
131+
_ = l.write(SeverityDefault, fmt.Sprintln(args...))
132132
}
133133

134134
// Debug logs a message at DEBUG severity
135135
func (l *ContextLogger) Debug(args ...interface{}) {
136-
l.write(SeverityDebug, fmt.Sprint(args...))
136+
_ = l.write(SeverityDebug, fmt.Sprint(args...))
137137
}
138138

139139
// Debugf logs a message at DEBUG severity
140140
func (l *ContextLogger) Debugf(format string, args ...interface{}) {
141-
l.write(SeverityDebug, fmt.Sprintf(format, args...))
141+
_ = l.write(SeverityDebug, fmt.Sprintf(format, args...))
142142
}
143143

144144
// Debugln logs a message at DEBUG severity
145145
func (l *ContextLogger) Debugln(args ...interface{}) {
146-
l.write(SeverityDebug, fmt.Sprintln(args...))
146+
_ = l.write(SeverityDebug, fmt.Sprintln(args...))
147147
}
148148

149149
// Info logs a message at INFO severity
150150
func (l *ContextLogger) Info(args ...interface{}) {
151-
l.write(SeverityInfo, fmt.Sprint(args...))
151+
_ = l.write(SeverityInfo, fmt.Sprint(args...))
152152
}
153153

154154
// Infof logs a message at INFO severity
155155
func (l *ContextLogger) Infof(format string, args ...interface{}) {
156-
l.write(SeverityInfo, fmt.Sprintf(format, args...))
156+
_ = l.write(SeverityInfo, fmt.Sprintf(format, args...))
157157
}
158158

159159
// Infoln logs a message at INFO severity
160160
func (l *ContextLogger) Infoln(args ...interface{}) {
161-
l.write(SeverityInfo, fmt.Sprintln(args...))
161+
_ = l.write(SeverityInfo, fmt.Sprintln(args...))
162162
}
163163

164164
// Notice logs a message at NOTICE severity
165165
func (l *ContextLogger) Notice(args ...interface{}) {
166-
l.write(SeverityNotice, fmt.Sprint(args...))
166+
_ = l.write(SeverityNotice, fmt.Sprint(args...))
167167
}
168168

169169
// Noticef logs a message at NOTICE severity
170170
func (l *ContextLogger) Noticef(format string, args ...interface{}) {
171-
l.write(SeverityNotice, fmt.Sprintf(format, args...))
171+
_ = l.write(SeverityNotice, fmt.Sprintf(format, args...))
172172
}
173173

174174
// Noticeln logs a message at NOTICE severity
175175
func (l *ContextLogger) Noticeln(args ...interface{}) {
176-
l.write(SeverityNotice, fmt.Sprintln(args...))
176+
_ = l.write(SeverityNotice, fmt.Sprintln(args...))
177177
}
178178

179179
// Warning logs a message at WARNING severity
180180
func (l *ContextLogger) Warning(args ...interface{}) {
181-
l.write(SeverityWarning, fmt.Sprint(args...))
181+
_ = l.write(SeverityWarning, fmt.Sprint(args...))
182182
}
183183

184184
// Warningf logs a message at WARNING severity
185185
func (l *ContextLogger) Warningf(format string, args ...interface{}) {
186-
l.write(SeverityWarning, fmt.Sprintf(format, args...))
186+
_ = l.write(SeverityWarning, fmt.Sprintf(format, args...))
187187
}
188188

189189
// Warningln logs a message at WARNING severity
190190
func (l *ContextLogger) Warningln(args ...interface{}) {
191-
l.write(SeverityWarning, fmt.Sprintln(args...))
191+
_ = l.write(SeverityWarning, fmt.Sprintln(args...))
192192
}
193193

194194
// Warn logs a message at WARNING severity
195195
func (l *ContextLogger) Warn(args ...interface{}) {
196-
l.write(SeverityWarning, fmt.Sprint(args...))
196+
_ = l.write(SeverityWarning, fmt.Sprint(args...))
197197
}
198198

199199
// Warnf logs a message at WARNING severity
200200
func (l *ContextLogger) Warnf(format string, args ...interface{}) {
201-
l.write(SeverityWarning, fmt.Sprintf(format, args...))
201+
_ = l.write(SeverityWarning, fmt.Sprintf(format, args...))
202202
}
203203

204204
// Warnln logs a message at WARNING severity
205205
func (l *ContextLogger) Warnln(args ...interface{}) {
206-
l.write(SeverityWarning, fmt.Sprintln(args...))
206+
_ = l.write(SeverityWarning, fmt.Sprintln(args...))
207207
}
208208

209209
// Error logs a message at ERROR severity
210210
func (l *ContextLogger) Error(args ...interface{}) {
211-
l.write(SeverityError, fmt.Sprint(args...))
211+
_ = l.write(SeverityError, fmt.Sprint(args...))
212212
}
213213

214214
// Errorf logs a message at ERROR severity
215215
func (l *ContextLogger) Errorf(format string, args ...interface{}) {
216-
l.write(SeverityError, fmt.Sprintf(format, args...))
216+
_ = l.write(SeverityError, fmt.Sprintf(format, args...))
217217
}
218218

219219
// Errorln logs a message at ERROR severity
220220
func (l *ContextLogger) Errorln(args ...interface{}) {
221-
l.write(SeverityError, fmt.Sprintln(args...))
221+
_ = l.write(SeverityError, fmt.Sprintln(args...))
222222
}
223223

224224
// Critical logs a message at CRITICAL severity
225225
func (l *ContextLogger) Critical(args ...interface{}) {
226-
l.write(SeverityCritical, fmt.Sprint(args...))
226+
_ = l.write(SeverityCritical, fmt.Sprint(args...))
227227
}
228228

229229
// Criticalf logs a message at CRITICAL severity
230230
func (l *ContextLogger) Criticalf(format string, args ...interface{}) {
231-
l.write(SeverityCritical, fmt.Sprintf(format, args...))
231+
_ = l.write(SeverityCritical, fmt.Sprintf(format, args...))
232232
}
233233

234234
// Criticalln logs a message at CRITICAL severity
235235
func (l *ContextLogger) Criticalln(args ...interface{}) {
236-
l.write(SeverityCritical, fmt.Sprintln(args...))
236+
_ = l.write(SeverityCritical, fmt.Sprintln(args...))
237237
}
238238

239239
// Alert logs a message at ALERT severity
240240
func (l *ContextLogger) Alert(args ...interface{}) {
241-
l.write(SeverityAlert, fmt.Sprint(args...))
241+
_ = l.write(SeverityAlert, fmt.Sprint(args...))
242242
}
243243

244244
// Alertf logs a message at ALERT severity
245245
func (l *ContextLogger) Alertf(format string, args ...interface{}) {
246-
l.write(SeverityAlert, fmt.Sprintf(format, args...))
246+
_ = l.write(SeverityAlert, fmt.Sprintf(format, args...))
247247
}
248248

249249
// Alertln logs a message at ALERT severity
250250
func (l *ContextLogger) Alertln(args ...interface{}) {
251-
l.write(SeverityAlert, fmt.Sprintln(args...))
251+
_ = l.write(SeverityAlert, fmt.Sprintln(args...))
252252
}
253253

254254
// Emergency logs a message at EMERGENCY severity
255255
func (l *ContextLogger) Emergency(args ...interface{}) {
256-
l.write(SeverityEmergency, fmt.Sprint(args...))
256+
_ = l.write(SeverityEmergency, fmt.Sprint(args...))
257257
}
258258

259259
// Emergencyf logs a message at EMERGENCY severity
260260
func (l *ContextLogger) Emergencyf(format string, args ...interface{}) {
261-
l.write(SeverityEmergency, fmt.Sprintf(format, args...))
261+
_ = l.write(SeverityEmergency, fmt.Sprintf(format, args...))
262262
}
263263

264264
// Emergencyln logs a message at EMERGENCY severity
265265
func (l *ContextLogger) Emergencyln(args ...interface{}) {
266-
l.write(SeverityEmergency, fmt.Sprintln(args...))
266+
_ = l.write(SeverityEmergency, fmt.Sprintln(args...))
267267
}
268268

269269
func (l *ContextLogger) write(severity Severity, msg string) error {
@@ -295,7 +295,8 @@ func (l *ContextLogger) write(severity Severity, msg string) error {
295295

296296
logJson, err := json.Marshal(log)
297297
if err != nil {
298-
fmt.Fprintln(os.Stderr, err.Error())
298+
_, _ = fmt.Fprintln(os.Stderr, err.Error())
299+
return err
299300
}
300301
logJson = append(logJson, '\n')
301302

0 commit comments

Comments
 (0)