Documentation
¶
Index ¶
- Constants
- func GetRequestBody(ctx *gin.Context) string
- func GetRequestID(ctx *gin.Context) string
- func GinCors(ctx *gin.Context)
- func GinLogHttpFail(ctx *gin.Context, err error)
- func GinLogger(ctx *gin.Context)
- func GinRecovery(ctx *gin.Context)
- func NewGorm2Logger() logger.Interface
- type DBLogger
- type EsLogger
- type InterFace
- type Logger
- func (l Logger) Debug(msg string)
- func (l Logger) Debugf(format string, args ...interface{})
- func (l Logger) Error(msg string)
- func (l Logger) Errorf(format string, args ...interface{})
- func (l Logger) Info(msg string)
- func (l Logger) Infof(format string, args ...interface{})
- func (l Logger) Print(v ...interface{})
- func (l Logger) Printf(format string, v ...interface{})
- func (l Logger) Warn(msg string)
- func (l Logger) Warnf(format string, args ...interface{})
- type RedisHook
- func (r RedisHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (r RedisHook) AfterProcessPipeline(ctx context.Context, cmdItems []redis.Cmder) error
- func (r RedisHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (r RedisHook) BeforeProcessPipeline(ctx context.Context, cmdItems []redis.Cmder) (context.Context, error)
Constants ¶
View Source
const ( XRequestID = "x-request-id" // 请求ID名称 TextGinPanic = "gin.panic.recovery" // gin panic日志标记 TextGinRequest = "gin.request" // gin request请求日志标记 TextGinResponseFail = "gin.response.fail" // gin 业务层面失败响应日志标记 TextGinPreflight = "gin.preflight" // gin preflight 御剑options请求类型日志 )
XRequestID 为每个请求分配的请求编号key和名称 1、优先从header头里读由nginx维护的并且转发过来的x-request-id 2、如果读取不到则使用当前纳秒时间戳字符串
Variables ¶
This section is empty.
Functions ¶
func GetRequestBody ¶ added in v1.8.3
GetRequestBody 获取请求body体
func GetRequestID ¶ added in v1.8.4
GetRequestID 暴露方法:读取当前请求ID
func GinLogHttpFail ¶ added in v1.8.4
GinLogHttpFail gin框架失败响应日志处理
func GinRecovery ¶ added in v1.8.3
GinRecovery zap实现的gin-recovery日志中间件<gin.HandlerFunc的实现>
func NewGorm2Logger ¶ added in v1.8.3
NewGorm2Logger 创建gorm2的logger实例
Types ¶
type Logger ¶
Logger logger封装, 实现第三方库的日志接口
type RedisHook ¶
type RedisHook struct{}
RedisHook redis hook implement
func (RedisHook) AfterProcess ¶
BeforeProcess redis执行命令后hook
func (RedisHook) AfterProcessPipeline ¶
BeforeProcess redis执行pipe后hook
func (RedisHook) BeforeProcess ¶
BeforeProcess redis执行命令前hook
Click to show internal directories.
Click to hide internal directories.