Documentation ¶
Index ¶
- Constants
- func EntAnnotations(table string, comment string) []schema.Annotation
- func EntApiLogFields(logName bool) []ent.Field
- func EntApiLogIndexes() []ent.Index
- func EntFrameLogFields(logName bool) []ent.Field
- func EntFrameLogIndexes() []ent.Index
- type ContextHandler
- type GinLog
- type GinLogBodyWriter
- type GinLogData
- type GinLogFun
- type GinLogFunc
- type HertzLog
- type HertzLogData
- type HertzLogFun
- 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.172"
)
Variables ¶
This section is empty.
Functions ¶
func EntAnnotations ¶ added in v1.0.157
func EntAnnotations(table string, comment string) []schema.Annotation
func EntFrameLogFields ¶ added in v1.0.169
EntFrameLogFields 框架日志模型
func EntFrameLogIndexes ¶ added in v1.0.169
EntFrameLogIndexes 框架日志模型
Types ¶
type ContextHandler ¶
type GinLog ¶ added in v1.0.169
type GinLog struct {
// contains filtered or unexported fields
}
GinLog 框架日志
func (*GinLog) Middleware ¶ added in v1.0.169
func (gg *GinLog) Middleware() gin.HandlerFunc
Middleware 中间件
func (*GinLog) SetLogFunc ¶ added in v1.0.169
func (gg *GinLog) SetLogFunc(ginLogFunc GinLogFunc)
SetLogFunc 设置日志记录方法
type GinLogBodyWriter ¶ added in v1.0.169
type GinLogBodyWriter struct { gin.ResponseWriter // contains filtered or unexported fields }
GinLogBodyWriter 定义一个自定义的 ResponseWriter
func (GinLogBodyWriter) Header ¶ added in v1.0.169
func (w GinLogBodyWriter) Header() http.Header
Header 实现 http.ResponseWriter 的 Header 方法
func (GinLogBodyWriter) Write ¶ added in v1.0.169
func (w GinLogBodyWriter) Write(b []byte) (int, error)
实现 http.ResponseWriter 的 Write 方法
func (GinLogBodyWriter) WriteHeader ¶ added in v1.0.169
func (w GinLogBodyWriter) WriteHeader(statusCode int)
WriteHeader 实现 http.ResponseWriter 的 WriteHeader 方法
func (GinLogBodyWriter) WriteString ¶ added in v1.0.169
func (w GinLogBodyWriter) WriteString(s string) (int, error)
WriteString 实现 http.ResponseWriter 的 WriteString 方法
type GinLogData ¶ added in v1.0.169
type GinLogData struct { TraceID string `json:"trace_id,omitempty"` // 跟踪编号 RequestID string `json:"request_id,omitempty"` // 请求编号 RequestTime time.Time `json:"request_time,omitempty"` // 请求时间 RequestHost string `json:"request_host,omitempty"` // 请求主机 RequestPath string `json:"request_path,omitempty"` // 请求地址 RequestQuery map[string]any `json:"request_query,omitempty"` // 请求参数 RequestMethod string `json:"request_method,omitempty"` // 请求方式 RequestBody map[string]any `json:"request_body,omitempty"` // 请求内容 RequestIP string `json:"request_ip,omitempty"` // 请求IP RequestHeader map[string][]string `json:"request_header,omitempty"` // 请求头 RequestCostTime int64 `json:"request_cost_time,omitempty"` // 请求消耗时长 ResponseTime time.Time `json:"response_time,omitempty"` // 响应时间 ResponseHeader map[string][]string `json:"response_header,omitempty"` // 响应头 ResponseCode int `json:"response_code,omitempty"` // 响应状态 ResponseBody map[string]any `json:"response_body,omitempty"` // 响应内容 }
GinLogData Gin框架日志模型
type GinLogFunc ¶
type GinLogFunc func(ctx context.Context, response *GinLogData)
GinLogFunc Gin框架日志函数
type HertzLog ¶ added in v1.0.169
type HertzLog struct {
// contains filtered or unexported fields
}
HertzLog 框架日志
func NewHertzLog ¶ added in v1.0.169
NewHertzLog 创建框架实例化
func (*HertzLog) Middleware ¶ added in v1.0.169
func (hg *HertzLog) Middleware() app.HandlerFunc
Middleware 中间件
func (*HertzLog) SetLogFunc ¶ added in v1.0.169
func (hg *HertzLog) SetLogFunc(hertzLogFunc HertzLogFunc)
SetLogFunc 设置日志记录方法
type HertzLogData ¶ added in v1.0.169
type HertzLogData struct { TraceID string `json:"trace_id,omitempty"` // 跟踪编号 RequestID string `json:"request_id,omitempty"` // 请求编号 RequestTime time.Time `json:"request_time,omitempty"` // 请求时间 RequestHost string `json:"request_host,omitempty"` // 请求主机 RequestPath string `json:"request_path,omitempty"` // 请求地址 RequestQuery map[string]any `json:"request_query,omitempty"` // 请求参数 RequestMethod string `json:"request_method,omitempty"` // 请求方式 RequestBody map[string]any `json:"request_body,omitempty"` // 请求内容 RequestIP string `json:"request_ip,omitempty"` // 请求IP RequestHeader map[string][]string `json:"request_header,omitempty"` // 请求头 RequestCostTime int64 `json:"request_cost_time,omitempty"` // 请求消耗时长 ResponseTime time.Time `json:"response_time,omitempty"` // 响应时间 ResponseHeader map[string][]string `json:"response_header,omitempty"` // 响应头 ResponseCode int `json:"response_code,omitempty"` // 响应状态 ResponseBody map[string]any `json:"response_body,omitempty"` // 响应内容 }
HertzLogData Hertz框架日志模型
type HertzLogFunc ¶
type HertzLogFunc func(ctx context.Context, response *HertzLogData)
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 显示代码行