modify text encoder format bug

This commit is contained in:
ehlxr 2020-12-31 17:26:35 +08:00
parent 48e8f68955
commit c03451395f
3 changed files with 5 additions and 2 deletions

View File

@ -222,11 +222,13 @@ func (enc *textEncoder) AddDuration(key string, val time.Duration) {
func (enc *textEncoder) AddFloat64(key string, val float64) { func (enc *textEncoder) AddFloat64(key string, val float64) {
enc.addKey(key) enc.addKey(key)
enc.appendFloat(val, 64) enc.appendFloat(val, 64)
enc.buf.AppendByte(']')
} }
func (enc *textEncoder) AddInt64(key string, val int64) { func (enc *textEncoder) AddInt64(key string, val int64) {
enc.addKey(key) enc.addKey(key)
enc.addElementSeparator() enc.addElementSeparator()
enc.buf.AppendInt(val) enc.buf.AppendInt(val)
enc.buf.AppendByte(']')
} }
func (enc *textEncoder) AddReflected(key string, obj interface{}) error { func (enc *textEncoder) AddReflected(key string, obj interface{}) error {
enc.resetReflectBuf() enc.resetReflectBuf()
@ -268,6 +270,7 @@ func (enc *textEncoder) AddUint64(key string, val uint64) {
enc.addKey(key) enc.addKey(key)
enc.addElementSeparator() enc.addElementSeparator()
enc.buf.AppendUint(val) enc.buf.AppendUint(val)
enc.buf.AppendByte(']')
} }
//noinspection GoRedundantConversion //noinspection GoRedundantConversion

View File

@ -21,7 +21,7 @@ func TestLogWithConfig(t *testing.T) {
config.Init() config.Init()
With("traceid", "21221212122") With("traceid", float64(21221212122))
Debugf("this is %s message", "debug") Debugf("this is %s message", "debug")
config.Init() config.Init()
With(zap.String("traceid", "12123123123")) With(zap.String("traceid", "12123123123"))

View File

@ -1 +1 @@
v0.0.7 v0.0.8