golog

package module
v1.0.129 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 27 Imported by: 44

README

Golang

📦 Golang 日志

godoc goproxy.cn goreportcard.com deps.dev

安装

go get -v -u go.dtapp.net/golog@v1.0.129

Documentation

Index

Constants

View Source
const (
	Version = "1.0.129"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiGorm added in v1.0.103

type ApiGorm struct {
	// contains filtered or unexported fields
}

ApiGorm 接口日志

func NewApiGorm added in v1.0.103

func NewApiGorm(ctx context.Context, gormClient *gorm.DB, gormTableName string) (*ApiGorm, error)

NewApiGorm 创建接口实例化

func (*ApiGorm) GormDeleteData added in v1.0.108

func (ag *ApiGorm) GormDeleteData(ctx context.Context, hour int64) error

GormDeleteData 删除N小时前数据

func (*ApiGorm) GormDeleteDataCustom added in v1.0.108

func (ag *ApiGorm) GormDeleteDataCustom(ctx context.Context, tableName string, hour int64) error

GormDeleteDataCustom 删除N小时前数据

func (*ApiGorm) Middleware added in v1.0.103

func (ag *ApiGorm) Middleware(ctx context.Context, request gorequest.Response)

Middleware 中间件

func (*ApiGorm) MiddlewareCustom added in v1.0.103

func (ag *ApiGorm) MiddlewareCustom(ctx context.Context, api string, request gorequest.Response)

MiddlewareCustom 中间件

func (*ApiGorm) MiddlewareXml added in v1.0.103

func (ag *ApiGorm) MiddlewareXml(ctx context.Context, request gorequest.Response)

MiddlewareXml 中间件

type ApiGormFun added in v1.0.103

type ApiGormFun func() *ApiGorm

ApiGormFun 接口日志驱动

type ApiSLog added in v1.0.103

type ApiSLog struct {
	// contains filtered or unexported fields
}

ApiSLog 接口日志

func NewApiSlog added in v1.0.103

func NewApiSlog(ctx context.Context) *ApiSLog

func (*ApiSLog) ConfigSLogClientFun added in v1.0.103

func (al *ApiSLog) ConfigSLogClientFun(sLogFun SLogFun)

ConfigSLogClientFun 日志配置

func (*ApiSLog) ConfigSLogResultClientFun added in v1.0.103

func (al *ApiSLog) ConfigSLogResultClientFun(sLogFun SLogFun) *ApiSLog

ConfigSLogResultClientFun 日志配置然后返回

func (*ApiSLog) Middleware added in v1.0.103

func (al *ApiSLog) Middleware(ctx context.Context, request gorequest.Response)

Middleware 中间件

func (*ApiSLog) MiddlewareCustom added in v1.0.103

func (al *ApiSLog) MiddlewareCustom(ctx context.Context, api string, request gorequest.Response)

MiddlewareCustom 中间件

func (*ApiSLog) MiddlewareXml added in v1.0.103

func (al *ApiSLog) MiddlewareXml(ctx context.Context, request gorequest.Response)

MiddlewareXml 中间件

type ApiSLogFun added in v1.0.103

type ApiSLogFun func() *ApiSLog

ApiSLogFun 接口日志驱动

type ContextHandler added in v1.0.129

type ContextHandler struct {
	slog.Handler
}

func (ContextHandler) Handle added in v1.0.129

func (h ContextHandler) Handle(ctx context.Context, r slog.Record) error

Handle 添加上下文属性到 Record 中,然后调用底层的 handler

type GinCustomClientGinRecordOperation added in v1.0.103

type GinCustomClientGinRecordOperation struct {
	// contains filtered or unexported fields
}

func (*GinCustomClientGinRecordOperation) CreateData added in v1.0.103

func (o *GinCustomClientGinRecordOperation) CreateData()

func (*GinCustomClientGinRecordOperation) CreateDataNoError added in v1.0.103

func (o *GinCustomClientGinRecordOperation) CreateDataNoError()

func (*GinCustomClientGinRecordOperation) CustomInfo added in v1.0.103

func (o *GinCustomClientGinRecordOperation) CustomInfo(customId any, customType any, customContent any) *GinCustomClientGinRecordOperation

type GinGorm added in v1.0.105

type GinGorm struct {
	// contains filtered or unexported fields
}

GinGorm 框架日志

func NewGinGorm added in v1.0.105

func NewGinGorm(ctx context.Context, gormClient *gorm.DB, gormTableName string) (*GinGorm, error)

NewGinGorm 创建框架实例化

func (*GinGorm) GormDeleteData added in v1.0.108

func (gg *GinGorm) GormDeleteData(ctx context.Context, hour int64) error

GormDeleteData 删除N小时前数据

func (*GinGorm) GormDeleteDataCustom added in v1.0.108

func (gg *GinGorm) GormDeleteDataCustom(ctx context.Context, tableName string, hour int64) error

GormDeleteDataCustom 删除N小时前数据

func (*GinGorm) Middleware added in v1.0.105

func (gg *GinGorm) Middleware() gin.HandlerFunc

Middleware 中间件

type GinGormFun added in v1.0.105

type GinGormFun func() *GinGorm

GinGormFun *GinGorm 框架日志驱动

type GinSLog added in v1.0.105

type GinSLog struct {
	// contains filtered or unexported fields
}

GinSLog 框架日志

func NewGinSLog added in v1.0.105

func NewGinSLog(ctx context.Context) (*GinSLog, error)

NewGinSLog 创建框架实例化

func (*GinSLog) ConfigSLogClientFun added in v1.0.105

func (gl *GinSLog) ConfigSLogClientFun(sLogFun SLogFun)

ConfigSLogClientFun 日志配置

func (*GinSLog) ConfigSLogResultClientFun added in v1.0.105

func (gl *GinSLog) ConfigSLogResultClientFun(sLogFun SLogFun) *GinSLog

ConfigSLogResultClientFun 日志配置然后返回

func (*GinSLog) Middleware added in v1.0.105

func (gl *GinSLog) Middleware() gin.HandlerFunc

Middleware 中间件

type GinSLogCustom added in v1.0.105

type GinSLogCustom struct {
	// contains filtered or unexported fields
}

GinSLogCustom 框架自定义日志

func NewGinSLogCustom added in v1.0.105

func NewGinSLogCustom(ctx context.Context) (*GinSLogCustom, error)

NewGinSLogCustom 创建框架实例化

func (*GinSLogCustom) ConfigSLogClientFun added in v1.0.105

func (c *GinSLogCustom) ConfigSLogClientFun(sLogFun SLogFun)

ConfigSLogClientFun 日志配置

func (*GinSLogCustom) ConfigSLogResultClientFun added in v1.0.105

func (c *GinSLogCustom) ConfigSLogResultClientFun(sLogFun SLogFun) *GinSLogCustom

ConfigSLogResultClientFun 日志配置然后返回

func (*GinSLogCustom) GinRecord added in v1.0.105

GinRecord 记录日志

type GinSLogCustomFun added in v1.0.105

type GinSLogCustomFun func() *GinSLogCustom

GinSLogCustomFun 框架自定义日志驱动

type GinSLogFun added in v1.0.105

type GinSLogFun func() *GinSLog

GinSLogFun 框架日志驱动

type HertzGorm added in v1.0.122

type HertzGorm struct {
	// contains filtered or unexported fields
}

HertzGorm 框架日志

func NewHertzGorm added in v1.0.122

func NewHertzGorm(ctx context.Context, gormClient *gorm.DB, gormTableName string) (*HertzGorm, error)

NewHertzGorm 创建框架实例化

func (*HertzGorm) GormDeleteData added in v1.0.125

func (hg *HertzGorm) GormDeleteData(ctx context.Context, hour int64) error

GormDeleteData 删除N小时前数据

func (*HertzGorm) GormDeleteDataCustom added in v1.0.125

func (hg *HertzGorm) GormDeleteDataCustom(ctx context.Context, tableName string, hour int64) error

GormDeleteDataCustom 删除N小时前数据

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 SLog added in v1.0.103

type SLog struct {
	// contains filtered or unexported fields
}

func NewSlog added in v1.0.128

func NewSlog(opts ...SLogOption) *SLog

NewSlog 创建

func (*SLog) WithLogger added in v1.0.103

func (sl *SLog) WithLogger() (logger *slog.Logger)

WithLogger 跟踪编号

func (*SLog) WithTraceID added in v1.0.115

func (sl *SLog) WithTraceID(ctx context.Context) *slog.Logger

WithTraceID 跟踪编号

func (*SLog) WithTraceIDStr added in v1.0.115

func (sl *SLog) WithTraceIDStr(traceID string) *slog.Logger

WithTraceIDStr 跟踪编号

func (*SLog) WithTraceId added in v1.0.103

func (sl *SLog) WithTraceId(ctx context.Context) *slog.Logger

WithTraceId 跟踪编号

func (*SLog) WithTraceIdStr added in v1.0.103

func (sl *SLog) WithTraceIdStr(traceID string) *slog.Logger

WithTraceIdStr 跟踪编号

type SLogFun added in v1.0.103

type SLogFun func() *SLog

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 WithSLogShowLine added in v1.0.128

func WithSLogShowLine() SLogOption

WithSLogShowLine 显示代码行

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL