Merge pull request #2490 from thaJeztah/logging_nanosecond_precision
Set default log formatting to use RFC3339Nano with fixed width
This commit is contained in:
commit
d47bda91e9
@ -48,6 +48,11 @@ high performance container runtime
|
|||||||
`
|
`
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
logrus.SetFormatter(&logrus.TextFormatter{
|
||||||
|
TimestampFormat: log.RFC3339NanoFixed,
|
||||||
|
FullTimestamp: true,
|
||||||
|
})
|
||||||
|
|
||||||
// Discard grpc logs so that they don't mess with our stdio
|
// Discard grpc logs so that they don't mess with our stdio
|
||||||
grpclog.SetLoggerV2(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard))
|
grpclog.SetLoggerV2(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard))
|
||||||
|
|
||||||
|
@ -42,6 +42,10 @@ type (
|
|||||||
// and is usually used to trace detailed behavior of the program.
|
// and is usually used to trace detailed behavior of the program.
|
||||||
const TraceLevel = logrus.Level(uint32(logrus.DebugLevel + 1))
|
const TraceLevel = logrus.Level(uint32(logrus.DebugLevel + 1))
|
||||||
|
|
||||||
|
// RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to
|
||||||
|
// ensure the formatted time is always the same number of characters.
|
||||||
|
const RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
|
||||||
|
|
||||||
// ParseLevel takes a string level and returns the Logrus log level constant.
|
// ParseLevel takes a string level and returns the Logrus log level constant.
|
||||||
// It supports trace level.
|
// It supports trace level.
|
||||||
func ParseLevel(lvl string) (logrus.Level, error) {
|
func ParseLevel(lvl string) (logrus.Level, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user