Documentation ¶
Index ¶
- Constants
- func EntApiLogFields() []ent.Field
- func EntApiLogIndexes() []ent.Index
- func EntGinLogFields() []ent.Field
- func EntGinLogIndexes() []ent.Index
- func EntHertzLogFields() []ent.Field
- func EntHertzLogIndexes() []ent.Index
- func TraceStartSpan(ctx context.Context, spanName string) (context.Context, trace.Span)
- type ApiGorm
- type ApiGormFun
- type ContextHandler
- type GinGorm
- type GinGormFun
- type GinLogFunc
- type GormApiLogModel
- type GormGinLogModel
- type GormHertzLogModel
- type HertzGorm
- type HertzGormFun
- type HertzLogFunc
- type SLog
- type SLogFun
- type SLogOption
- func WithSLogLumberjack(config *lumberjack.Logger) SLogOption
- func WithSLogSetDefault() SLogOption
- func WithSLogSetDefaultCtx() SLogOption
- func WithSLogSetDefaultCtxPass(status bool) SLogOption
- func WithSLogSetDefaultPass(status bool) SLogOption
- func WithSLogSetJSONFormat() SLogOption
- func WithSLogSetJSONFormatPass(status bool) SLogOption
- func WithSLogShowLine() SLogOption
- func WithSLogShowLinePass(status bool) SLogOption
Constants ¶
const (
Version = "1.0.151"
)
Variables ¶
This section is empty.
Functions ¶
func EntApiLogIndexes ¶ added in v1.0.139
EntApiLogIndexes 请求日志模型
func EntGinLogFields ¶ added in v1.0.139
EntGinLogFields Gin框架日志模型
func EntGinLogIndexes ¶ added in v1.0.139
EntGinLogIndexes Gin框架日志模型
func EntHertzLogFields ¶ added in v1.0.139
EntHertzLogFields Hertz框架日志模型
func EntHertzLogIndexes ¶ added in v1.0.139
EntHertzLogIndexes Hertz框架日志模型
Types ¶
type ApiGorm ¶ added in v1.0.103
type ApiGorm struct {
// contains filtered or unexported fields
}
ApiGorm 接口日志
func NewApiGorm ¶ added in v1.0.103
NewApiGorm 创建接口实例化
func (*ApiGorm) Middleware ¶ added in v1.0.103
Middleware 中间件
func (*ApiGorm) MiddlewareCustom ¶ added in v1.0.103
MiddlewareCustom 中间件
func (*ApiGorm) MiddlewareXml ¶ added in v1.0.103
MiddlewareXml 中间件
type ContextHandler ¶ added in v1.0.129
type GinGorm ¶ added in v1.0.105
type GinGorm struct {
// contains filtered or unexported fields
}
GinGorm 框架日志
func NewGinGorm ¶ added in v1.0.105
NewGinGorm 创建Gin框架实例
func (*GinGorm) Middleware ¶ added in v1.0.105
func (gg *GinGorm) Middleware() gin.HandlerFunc
Middleware 中间件
func (*GinGorm) SetLogFunc ¶ added in v1.0.145
func (gg *GinGorm) SetLogFunc(ginLogFunc GinLogFunc)
SetLogFunc 设置日志记录方法
type GinLogFunc ¶ added in v1.0.145
type GinLogFunc func(ctx context.Context, response *GormGinLogModel)
GinLogFunc Gin框架日志函数
type GormApiLogModel ¶ added in v1.0.139
type GormApiLogModel struct { TraceID string `gorm:"index;comment:跟踪编号" json:"trace_id,omitempty"` // 跟踪编号 RequestID string `gorm:"index;comment:请求编号" json:"request_id,omitempty"` // 请求编号 RequestTime time.Time `gorm:"index;comment:请求时间" json:"request_time,omitempty"` // 请求时间 RequestUri string `gorm:"index;comment:请求链接" json:"request_uri,omitempty"` // 请求链接 RequestUrl string `gorm:"index;comment:请求链接" json:"request_url,omitempty"` // 请求链接 RequestApi string `gorm:"index;comment:请求接口" json:"request_api,omitempty"` // 请求接口 RequestMethod string `gorm:"index;comment:请求方式" json:"request_method,omitempty"` // 请求方式 RequestParams string `gorm:"comment:请求参数" json:"request_params,omitempty"` // 请求参数 RequestHeader string `gorm:"comment:请求头部" json:"request_header,omitempty"` // 请求头部 RequestIP string `gorm:"comment:请求请求IP" json:"request_ip,omitempty"` // 请求请求IP RequestCostTime int64 `gorm:"comment:请求消耗时长" json:"request_cost_time,omitempty"` // 请求消耗时长 ResponseHeader string `gorm:"comment:响应头部" json:"response_header,omitempty"` // 响应头部 ResponseStatusCode int `gorm:"comment:响应状态码" json:"response_status_code,omitempty"` // 响应状态码 ResponseBody string `gorm:"comment:响应数据" json:"response_body,omitempty"` // 响应数据 ResponseTime time.Time `gorm:"index;comment:响应时间" json:"response_time,omitempty"` // 响应时间 }
GormApiLogModel 请求日志模型
type GormGinLogModel ¶ added in v1.0.139
type GormGinLogModel struct { TraceID string `gorm:"index;comment:跟踪编号" json:"trace_id,omitempty"` // 跟踪编号 RequestID string `gorm:"index;comment:请求编号" json:"request_id,omitempty"` // 请求编号 RequestTime time.Time `gorm:"index;comment:请求时间" json:"request_time,omitempty"` // 请求时间 RequestHost string `gorm:"comment:请求主机" json:"request_host,omitempty"` // 请求主机 RequestPath string `gorm:"index;comment:请求地址" json:"request_path,omitempty"` // 请求地址 RequestQuery string `gorm:"comment:请求参数" json:"request_query,omitempty"` // 请求参数 RequestMethod string `gorm:"index;comment:请求方式" json:"request_method,omitempty"` // 请求方式 RequestScheme string `gorm:"comment:请求协议" json:"request_scheme,omitempty"` // 请求协议 RequestContentType string `gorm:"comment:请求类型" json:"request_content_type,omitempty"` // 请求类型 RequestBody string `gorm:"comment:请求内容" json:"request_body,omitempty"` // 请求内容 RequestClientIP string `gorm:"comment:请求IP" json:"request_client_ip,omitempty"` // 请求IP RequestUserAgent string `gorm:"comment:请求UA" json:"request_user_agent,omitempty"` // 请求UA RequestHeader string `gorm:"comment:请求头" json:"request_header,omitempty"` // 请求头 RequestCostTime int64 `gorm:"comment:请求消耗时长" json:"request_cost_time,omitempty"` // 请求消耗时长 ResponseTime time.Time `gorm:"index;comment:响应时间" json:"response_time,omitempty"` // 响应时间 ResponseHeader string `gorm:"comment:响应头" json:"response_header,omitempty"` // 响应头 ResponseStatusCode int `gorm:"comment:响应状态" json:"response_status_code,omitempty"` // 响应状态 ResponseBody string `gorm:"comment:响应内容" json:"response_body,omitempty"` // 响应内容 }
GormGinLogModel Gin框架日志模型
type GormHertzLogModel ¶ added in v1.0.139
type GormHertzLogModel struct { TraceID string `gorm:"index;comment:跟踪编号" json:"trace_id,omitempty"` // 跟踪编号 RequestID string `gorm:"index;comment:请求编号" json:"request_id,omitempty"` // 请求编号 RequestTime time.Time `gorm:"index;comment:请求时间" json:"request_time,omitempty"` // 请求时间 RequestHost string `gorm:"comment:请求主机" json:"request_host,omitempty"` // 请求主机 RequestPath string `gorm:"index;comment:请求地址" json:"request_path,omitempty"` // 请求地址 RequestQuery string `gorm:"comment:请求参数" json:"request_query,omitempty"` // 请求参数 RequestMethod string `gorm:"index;comment:请求方式" json:"request_method,omitempty"` // 请求方式 RequestScheme string `gorm:"comment:请求协议" json:"request_scheme,omitempty"` // 请求协议 RequestContentType string `gorm:"comment:请求类型" json:"request_content_type,omitempty"` // 请求类型 RequestBody string `gorm:"comment:请求内容" json:"request_body,omitempty"` // 请求内容 RequestClientIP string `gorm:"comment:请求IP" json:"request_client_ip,omitempty"` // 请求IP RequestUserAgent string `gorm:"comment:请求UA" json:"request_user_agent,omitempty"` // 请求UA RequestHeader string `gorm:"comment:请求头" json:"request_header,omitempty"` // 请求头 RequestCostTime int64 `gorm:"comment:请求消耗时长" json:"request_cost_time,omitempty"` // 请求消耗时长 ResponseTime time.Time `gorm:"index;comment:响应时间" json:"response_time,omitempty"` // 响应时间 ResponseHeader string `gorm:"comment:响应头" json:"response_header,omitempty"` // 响应头 ResponseStatusCode int `gorm:"comment:响应状态" json:"response_status_code,omitempty"` // 响应状态 ResponseBody string `gorm:"comment:响应内容" json:"response_body,omitempty"` // 响应内容 }
GormHertzLogModel Hertz框架日志模型
type HertzGorm ¶ added in v1.0.122
type HertzGorm struct {
// contains filtered or unexported fields
}
HertzGorm 框架日志
func NewHertzGorm ¶ added in v1.0.122
NewHertzGorm 创建框架实例化
func (*HertzGorm) Middleware ¶ added in v1.0.122
func (hg *HertzGorm) Middleware() app.HandlerFunc
Middleware 中间件
type HertzGormFun ¶ added in v1.0.122
type HertzGormFun func() *HertzGorm
HertzGormFun *HertzGorm 框架日志驱动
type HertzLogFunc ¶ added in v1.0.145
type HertzLogFunc func(ctx context.Context, response *GormHertzLogModel)
HertzLogFunc Hertz框架日志函数
type SLog ¶ added in v1.0.103
type SLog struct {
// contains filtered or unexported fields
}
func (*SLog) WithLogger ¶ added in v1.0.103
WithLogger 跟踪编号
type SLogOption ¶ added in v1.0.128
type SLogOption func(*SLog)
func WithSLogLumberjack ¶ added in v1.0.128
func WithSLogLumberjack(config *lumberjack.Logger) SLogOption
WithSLogLumberjack Lumberjack配置 Filename 日志文件的位置 MaxSize 文件最大尺寸(以MB为单位) MaxAge 留旧文件的最大天数 MaxBackups 保留的最大旧文件数量 Compress 是否压缩/归档旧文件 LocalTime 使用本地时间创建时间戳
func WithSLogSetDefault ¶ added in v1.0.129
func WithSLogSetDefault() SLogOption
WithSLogSetDefault 设置为默认的实例
func WithSLogSetDefaultCtx ¶ added in v1.0.129
func WithSLogSetDefaultCtx() SLogOption
WithSLogSetDefaultCtx 设置默认上下文
func WithSLogSetDefaultCtxPass ¶ added in v1.0.132
func WithSLogSetDefaultCtxPass(status bool) SLogOption
WithSLogSetDefaultCtxPass 设置默认上下文
func WithSLogSetDefaultPass ¶ added in v1.0.132
func WithSLogSetDefaultPass(status bool) SLogOption
WithSLogSetDefaultPass 设置为默认的实例
func WithSLogSetJSONFormat ¶ added in v1.0.131
func WithSLogSetJSONFormat() SLogOption
WithSLogSetJSONFormat 设置JSON格式
func WithSLogSetJSONFormatPass ¶ added in v1.0.132
func WithSLogSetJSONFormatPass(status bool) SLogOption
WithSLogSetJSONFormatPass 设置JSON格式
func WithSLogShowLinePass ¶ added in v1.0.132
func WithSLogShowLinePass(status bool) SLogOption
WithSLogShowLinePass 显示代码行