package
0.0.0-20240919033358-cce434e5d354
Repository: https://github.com/codfrm/cago.git
Documentation: pkg.go.dev

# README

日志组件

封装zap作为日志组件

使用

logger.Default().Info("info")
logger.With(zap.String("key", "value")).Info("info")

// 把日志实例放入context中
ctx:=logger.ContextWith(ctx, zap.String("key", "value"))
ctx:=logger.ContextWithLogger(ctx, logger.With(zap.String("key", "value")))

// 从context中取出日志实例使用
logger.Ctx(ctx).Info("info")
logger.CtxWith(ctx, zap.String("key", "value")).Info("info")

# Packages

No description provided by the author

# Functions

No description provided by the author
Ctx 从上下文中获取日志实例.
Default 默认日志,尽量不要使用,会丢失上下文信息.
No description provided by the author
Logger 日志组件,核心组件,必须提前注册.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SetLogger 设置全局日志实例.
No description provided by the author
With 默认日志添加字段,尽量不要使用,会丢失上下文信息.
WithContextField 取出context中的日志实例并添加字段存入上下文 在想为后续操作添加字段时使用 logger.WithContextField(ctx, zap.String("key", "value")).
WithContextLogger 将日志实例存入上下文 在想为后续操作指定日志实例时使用 logger.WithContextLogger(ctx, logger.With(zap.String("key", "value"))).
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author