Documentation ¶
Index ¶
- Constants
- Variables
- func AddCtxSkip(ctx context.Context, skip int) context.Context
- func AppendCtxFields(ctx context.Context, fields ...zap.Field) context.Context
- func DebugCtx(ctx context.Context, msg string, fields ...zap.Field)
- func DelLogger(name string)
- func ErrorCtx(ctx context.Context, msg string, fields ...zap.Field)
- func FieldAddr(v string) zap.Field
- func FieldComponent(value string) zap.Field
- func FieldCost(v time.Duration) zap.Field
- func FieldDuration(v time.Duration) zap.Field
- func FieldError(err error) zap.Field
- func FieldEvent(event string) zap.Field
- func FieldMethod(v string) zap.Field
- func FieldName(v string) zap.Field
- func FieldReq(req interface{}) zap.Field
- func FieldResp(resp interface{}) zap.Field
- func FieldSlow(isSlow bool) zap.Field
- func FieldSpanID(id string) zap.Field
- func FieldTrace(id string) zap.Field
- func GetCtxFields(ctx context.Context) []zap.Field
- func GetCtxSkip(ctx context.Context) int
- func GetLoggerFromCtx(ctx context.Context) logx.GLog
- func InfoCtx(ctx context.Context, msg string, fields ...zap.Field)
- func MakeReqResError(callerSkip int, compName string, addr string, duration time.Duration, ...) zap.Field
- func MakeReqResInfo(callerSkip int, compName string, addr string, duration time.Duration, ...) zap.Field
- func MergeCtxFields(ctx context.Context, fields ...zap.Field) []zap.Field
- func SetLogerName(ctx context.Context, name string) context.Context
- func SetLogger(name string, logger logx.GLog)
- func WarnCtx(ctx context.Context, msg string, fields ...zap.Field)
- type CtxFieldKey
- type CtxFieldsKey
- type CtxLogLevelKey
- type CtxLoggerNameKey
- type CtxSkipKey
- type LogLevel
Constants ¶
View Source
const ( KeyComponent = "comp" KeyError = "error" KeyTraceID = "trace_id" KeySpanID = "span_id" KeyEvent = "event" KeyCost = "duration" KeyDuration = "duration" KeyMethod = "method" KeyName = "name" KeyAddr = "addr" KeyRestyResponse = "resty_response" KeyReq = "req" KeyResp = "resp" KeyDetail = "detail" KeySlow = "slow" )
View Source
const DefaultSkip = 2
View Source
const (
Ezap = "ezap"
)
Variables ¶
View Source
var ( Logger sync.Map DefaultLogger = ezap.NewConsoleEzap() )
Functions ¶
func AppendCtxFields ¶
func GetCtxSkip ¶
func MakeReqResError ¶
func MakeReqResError(callerSkip int, compName string, addr string, duration time.Duration, req string, err string) zap.Field
MakeReqResError 以error级别打印行号、配置名、目标地址、耗时、请求数据、响应数据
Types ¶
type CtxFieldKey ¶
type CtxFieldKey struct{}
type CtxFieldsKey ¶
type CtxFieldsKey struct{}
type CtxLogLevelKey ¶
type CtxLogLevelKey struct{}
type CtxLoggerNameKey ¶
type CtxLoggerNameKey struct{}
type CtxSkipKey ¶
type CtxSkipKey struct{}
Click to show internal directories.
Click to hide internal directories.