Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(ctx context.Context, msg string, args ...interface{})
- func Error(ctx context.Context, msg string, args ...interface{})
- func Info(ctx context.Context, msg string, args ...interface{})
- func Init(filename string, maxSize, maxBackup, maxAge int, compress bool, logType string, ...)
- func InitByConfig()
- func LogIf(ctx context.Context, err error)
- func LogInfoIf(ctx context.Context, err error)
- func LogWarnIf(ctx context.Context, err error)
- func Recover(ctx context.Context)
- func SetLogXFields(ctx context.Context, keyValues map[string]string) context.Context
- func Warn(ctx context.Context, msg string, args ...interface{})
Constants ¶
View Source
const ( CommonLogXFields = "common-log-x-fields" XUID = "x-uid" XRequestID = "x-request-id" XRequestMethod = "x-request-method" XRequestURI = "x-request-uri" XRequestPath = "x-request-path" XUserAgent = "x-ua" XClientIP = "x-client-ip" )
ctx common log key
View Source
const ( KeyReturnCode = "x-return-code" CtxUser = "x-user" )
Variables ¶
View Source
var DB string
DB 记录log到db中
View Source
var Logger *zap.Logger
Logger 全局 Logger 对象
Functions ¶
func Init ¶ added in v1.1.42
func Init(filename string, maxSize, maxBackup, maxAge int, compress bool, logType string, level string)
Init 日志初始化
func SetLogXFields ¶ added in v1.1.34
SetLogXFields 上下文设置通用日志x字段
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.