代码拉取完成,页面将自动刷新
package log
import (
"math"
"time"
"gitee.com/djienet/kratos/pkg/log/internal/core"
)
// D represents a map of entry level data used for structured logging.
// type D map[string]interface{}
type D = core.Field
// KVString construct Field with string value.
func KVString(key string, value string) D {
return D{Key: key, Type: core.StringType, StringVal: value}
}
// KVInt construct Field with int value.
func KVInt(key string, value int) D {
return D{Key: key, Type: core.IntTpye, Int64Val: int64(value)}
}
// KVInt64 construct D with int64 value.
func KVInt64(key string, value int64) D {
return D{Key: key, Type: core.Int64Type, Int64Val: value}
}
// KVUint construct Field with uint value.
func KVUint(key string, value uint) D {
return D{Key: key, Type: core.UintType, Int64Val: int64(value)}
}
// KVUint64 construct Field with uint64 value.
func KVUint64(key string, value uint64) D {
return D{Key: key, Type: core.Uint64Type, Int64Val: int64(value)}
}
// KVFloat32 construct Field with float32 value.
func KVFloat32(key string, value float32) D {
return D{Key: key, Type: core.Float32Type, Int64Val: int64(math.Float32bits(value))}
}
// KVFloat64 construct Field with float64 value.
func KVFloat64(key string, value float64) D {
return D{Key: key, Type: core.Float64Type, Int64Val: int64(math.Float64bits(value))}
}
// KVDuration construct Field with Duration value.
func KVDuration(key string, value time.Duration) D {
return D{Key: key, Type: core.DurationType, Int64Val: int64(value)}
}
// KV return a log kv for logging field.
// NOTE: use KV{type name} can avoid object alloc and get better performance. []~( ̄▽ ̄)~*干杯
func KV(key string, value interface{}) D {
return D{Key: key, Value: value}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。