logs

package
v1.3.31 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close added in v0.1.3

func Close()

Close 关闭日志

func Debug

func Debug(args ...interface{})

Debug 调试

func DebugContext added in v0.1.3

func DebugContext(ctx context.Context, args ...interface{})

DebugContext 调试

func DebugContextf added in v0.1.3

func DebugContextf(ctx context.Context, template string, args ...interface{})

DebugContextf 调试

func DebugContextw added in v1.3.17

func DebugContextw(ctx context.Context, msg string, keysAndValues ...interface{})

func Debugf

func Debugf(template string, args ...interface{})

Debugf 调试

func Debugw

func Debugw(msg string, keysAndValues ...interface{})

Debugw 调试

func Desugar

func Desugar() *zap.Logger

Desugar 获取底层zap.Logger

func Error

func Error(args ...interface{})

Error 错误信息

func ErrorContext added in v0.1.3

func ErrorContext(ctx context.Context, args ...interface{})

ErrorContext 错误信息

func ErrorContextf added in v0.1.3

func ErrorContextf(ctx context.Context, template string, args ...interface{})

ErrorContextf 错误信息

func ErrorContextw added in v1.3.17

func ErrorContextw(ctx context.Context, msg string, keysAndValues ...interface{})

func Errorf

func Errorf(template string, args ...interface{})

Errorf 错误信息

func Errorw

func Errorw(msg string, keysAndValues ...interface{})

Errorw 错误信息

func Fatal

func Fatal(args ...interface{})

Fatal 致命错误

func FatalContext added in v0.1.3

func FatalContext(ctx context.Context, args ...interface{})

FatalContext 致命错误

func FatalContextf added in v0.1.3

func FatalContextf(ctx context.Context, template string, args ...interface{})

FatalContextf 致命错误

func FatalContextw added in v1.3.17

func FatalContextw(ctx context.Context, msg string, keysAndValues ...interface{})

func Fatalf

func Fatalf(template string, args ...interface{})

Fatalf 致命错误

func Fatalw

func Fatalw(msg string, keysAndValues ...interface{})

Fatalw 致命错误

func Get

func Get(lgr string) *zap.SugaredLogger

Get 获取日志实例

func GetGorm

func GetGorm(lgrName string) glogger.Interface

GetGorm 获取gorm日志

func Info added in v0.1.3

func Info(args ...interface{})

Info 提示信息

func InfoContext added in v0.1.3

func InfoContext(ctx context.Context, args ...interface{})

InfoContext 提示信息

func InfoContextf added in v0.1.3

func InfoContextf(ctx context.Context, template string, args ...interface{})

InfoContextf 提示信息

func InfoContextw added in v1.3.17

func InfoContextw(ctx context.Context, msg string, keysAndValues ...interface{})

func Infof

func Infof(template string, args ...interface{})

Infof 提示信息

func Infow

func Infow(msg string, keysAndValues ...interface{})

Infow 提示信息

func JSON

func JSON(v interface{}) string

JSON format to json

func LoggerFromContext added in v0.1.5

func LoggerFromContext(ctx context.Context) *zap.SugaredLogger

LoggerFromContext 获取日志上下文

func Named

func Named(name string) *zap.SugaredLogger

Named 获取并设置命名日志实例

func NewTencentClsSyncer added in v0.1.3

func NewTencentClsSyncer(cfg config.TencentCLSConfig) (zapcore.WriteSyncer, error)

NewTencentClsSyncer 阿里云日志服务

func NewWorkwxSyncer

func NewWorkwxSyncer(wxKey string) zapcore.WriteSyncer

NewWorkwxSyncer 企业微信日志

func ReloadConfig

func ReloadConfig(module string, cfg config.LogsConfig) error

ReloadConfig .

func RequestLogger

func RequestLogger(reqid string) *zap.SugaredLogger

RequestLogger 接口请求日志 需要配置access日志

func SetContextFields added in v0.1.5

func SetContextFields(ctx context.Context, fields ...interface{})

SetContextFields 设置日志上下文

func SetContextLogger added in v0.1.5

func SetContextLogger(ctx context.Context, l *zap.SugaredLogger)

SetContextLogger 设置日志上下文

func SetLevel

func SetLevel(lvl zapcore.Level)

SetLevel 设置默认日志级别

func Sync

func Sync() error

Sync 同步日志缓冲区

func Warn

func Warn(args ...interface{})

Warn 警告信息

func WarnContext added in v0.1.3

func WarnContext(ctx context.Context, args ...interface{})

WarnContext 警告信息

func WarnContextf added in v0.1.3

func WarnContextf(ctx context.Context, template string, args ...interface{})

WarnContextf 警告信息

func WarnContextw added in v1.3.17

func WarnContextw(ctx context.Context, msg string, keysAndValues ...interface{})

func Warnf

func Warnf(template string, args ...interface{})

Warnf 警告信息

func Warnw

func Warnw(msg string, keysAndValues ...interface{})

Warnw 警告信息

func With

func With(args ...interface{}) *zap.SugaredLogger

With 设置日志字段, 返回一个新的日志对象,参数为键值对, 如: With("key", "value")

func WithContextFields added in v0.1.3

func WithContextFields(ctx context.Context, fields ...interface{}) context.Context

WithContextFields 设置日志字段上下文

func WithContextLogger added in v0.1.3

func WithContextLogger(ctx context.Context, l *zap.SugaredLogger) context.Context

WithContextLogger 设置日志上下文

Types

type ESLogger added in v1.3.17

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

func GetESLogger added in v1.3.17

func GetESLogger(cfg ESLoggerConfig) *ESLogger

func (*ESLogger) LogRoundTrip added in v1.3.17

func (e *ESLogger) LogRoundTrip(req *http.Request, res *http.Response, err error, start time.Time, dur time.Duration) error

func (*ESLogger) RequestBodyEnabled added in v1.3.17

func (e *ESLogger) RequestBodyEnabled() bool

func (*ESLogger) ResponseBodyEnabled added in v1.3.17

func (e *ESLogger) ResponseBodyEnabled() bool

type ESLoggerConfig added in v1.3.17

type ESLoggerConfig struct {
	LoggerName    string        // 日志模块名称
	SlowThreshold time.Duration // 慢查询阈值
}

Jump to

Keyboard shortcuts

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