Skip to content

Commit

Permalink
Use nanoseconds for logging time.Duration
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkroh authored and ph committed Dec 23, 2017
1 parent 1006a5c commit 0dd48dc
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions libbeat/logp/encoding.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package logp

import (
"time"

"go.uber.org/zap/zapcore"
)

Expand All @@ -16,7 +14,7 @@ var baseEncodingConfig = zapcore.EncoderConfig{
LineEnding: zapcore.DefaultLineEnding,
EncodeLevel: zapcore.LowercaseLevelEncoder,
EncodeTime: zapcore.ISO8601TimeEncoder,
EncodeDuration: millisecondsDurationEncoder,
EncodeDuration: zapcore.NanosDurationEncoder,
EncodeCaller: zapcore.ShortCallerEncoder,
EncodeName: zapcore.FullNameEncoder,
}
Expand Down Expand Up @@ -49,10 +47,6 @@ func syslogEncoderConfig() zapcore.EncoderConfig {
return c
}

func millisecondsDurationEncoder(d time.Duration, enc zapcore.PrimitiveArrayEncoder) {
enc.AppendFloat64(float64(d) / float64(time.Millisecond))
}

func bracketedNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder) {
enc.AppendString("[" + loggerName + "]")
}

0 comments on commit 0dd48dc

Please sign in to comment.