This commit is contained in:
Kevin Wan
2021-12-13 11:58:58 +08:00
committed by GitHub
parent 07191dc430
commit 914692cc82
5 changed files with 50 additions and 11 deletions

View File

@@ -79,8 +79,10 @@ func (l *durationLogger) WithDuration(duration time.Duration) Logger {
}
func (l *durationLogger) write(writer io.Writer, level string, val interface{}) {
l.Timestamp = getTimestamp()
l.Level = level
l.Content = val
outputJson(writer, l)
outputJson(writer, &durationLogger{
Timestamp: getTimestamp(),
Level: level,
Content: val,
Duration: l.Duration,
})
}