Skip to content

Commit

Permalink
feat(log): Set log-level timestamps to nano-level precision (#1833)
Browse files Browse the repository at this point in the history
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
  • Loading branch information
craciunoiuc authored Aug 7, 2024
2 parents e654ddb + ae195df commit e7bad5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions log/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"golang.org/x/term"
)

const defaultTimestampFormat = time.RFC3339
const defaultTimestampFormat = time.RFC3339Nano

var (
baseTimestamp time.Time = time.Now()
Expand Down Expand Up @@ -265,7 +265,7 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *logrus.Entry, keys
if !f.FullTimestamp {
timestamp = fmt.Sprintf("[%04d]", miniTS())
} else {
timestamp = entry.Time.Format(timestampFormat)
timestamp = fmt.Sprintf("%-32s", entry.Time.Format(timestampFormat))
}
fmt.Fprintf(b, "%s %s%s "+messageFormat, level, colorScheme.Timestamp(timestamp), prefix, message)
}
Expand Down

0 comments on commit e7bad5c

Please sign in to comment.