modify text encoder format bug
This commit is contained in:
parent
48e8f68955
commit
c03451395f
@ -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
|
||||||
|
@ -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"))
|
||||||
|
Loading…
Reference in New Issue
Block a user