Documentation
¶
Index ¶
- Constants
- func EntAnnotations(table string, comment string) []schema.Annotation
- 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 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 ¶
View Source
const (
Version = "1.0.167"
)
Variables ¶
This section is empty.
Functions ¶
func EntAnnotations ¶
func EntAnnotations(table string, comment string) []schema.Annotation
Types ¶
type ContextHandler ¶
type GinGorm ¶
type GinGorm struct {
// contains filtered or unexported fields
}
GinGorm 框架日志
func (*GinGorm) SetLogFunc ¶
func (gg *GinGorm) SetLogFunc(ginLogFunc GinLogFunc)
SetLogFunc 设置日志记录方法
type GinLogFunc ¶
type GinLogFunc func(ctx context.Context, response *GormGinLogModel)
GinLogFunc Gin框架日志函数
type GormApiLogModel ¶
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"` // 请求时间 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"` // 响应内容 GoVersion string `gorm:"comment:Go版本" json:"go_version,omitempty"` // Go版本 SdkVersion string `gorm:"comment:SDK版本" json:"sdk_version,omitempty"` // SDK版本 }
GormApiLogModel 请求日志模型
type GormGinLogModel ¶
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"` // 响应内容 GoVersion string `gorm:"comment:Go版本" json:"go_version,omitempty"` // Go版本 SdkVersion string `gorm:"comment:SDK版本" json:"sdk_version,omitempty"` // SDK版本 }
GormGinLogModel Gin框架日志模型
type GormHertzLogModel ¶
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"` // 响应内容 GoVersion string `gorm:"comment:Go版本" json:"go_version,omitempty"` // Go版本 SdkVersion string `gorm:"comment:SDK版本" json:"sdk_version,omitempty"` // SDK版本 }
GormHertzLogModel Hertz框架日志模型
type HertzGorm ¶
type HertzGorm struct {
// contains filtered or unexported fields
}
HertzGorm 框架日志
func (*HertzGorm) SetLogFunc ¶
func (hg *HertzGorm) SetLogFunc(hertzLogFunc HertzLogFunc)
SetLogFunc 设置日志记录方法
type HertzLogFunc ¶
type HertzLogFunc func(ctx context.Context, response *GormHertzLogModel)
HertzLogFunc Hertz框架日志函数
type SLogOption ¶
type SLogOption func(*SLog)
func WithSLogLumberjack ¶
func WithSLogLumberjack(config *lumberjack.Logger) SLogOption
WithSLogLumberjack Lumberjack配置 Filename 日志文件的位置 MaxSize 文件最大尺寸(以MB为单位) MaxAge 留旧文件的最大天数 MaxBackups 保留的最大旧文件数量 Compress 是否压缩/归档旧文件 LocalTime 使用本地时间创建时间戳
func WithSLogSetDefaultCtxPass ¶
func WithSLogSetDefaultCtxPass(status bool) SLogOption
WithSLogSetDefaultCtxPass 设置默认上下文
func WithSLogSetDefaultPass ¶
func WithSLogSetDefaultPass(status bool) SLogOption
WithSLogSetDefaultPass 设置为默认的实例
func WithSLogSetJSONFormatPass ¶
func WithSLogSetJSONFormatPass(status bool) SLogOption
WithSLogSetJSONFormatPass 设置JSON格式
func WithSLogShowLinePass ¶
func WithSLogShowLinePass(status bool) SLogOption
WithSLogShowLinePass 显示代码行
Click to show internal directories.
Click to hide internal directories.