log

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

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

Debug 调试日志

func DebugWith

func DebugWith(ctx context.Context, addFields []logger.Field, args ...interface{})

DebugWith 调试日志,带用户自定义上报字段 addFields

func DebugWithf

func DebugWithf(ctx context.Context, addFields []logger.Field, format string, args ...interface{})

DebugWithf 调试日志,带用户自定义上报字段 addFields

func Debugf

func Debugf(ctx context.Context, format string, args ...interface{})

Debugf 调试日志

func Error

func Error(ctx context.Context, code int, args ...interface{})

Error 错误日志

func ErrorWith

func ErrorWith(ctx context.Context, addFields []logger.Field, code int, args ...interface{})

ErrorWith 错误日志,带用户自定义上报字段 addFields

func ErrorWithf

func ErrorWithf(ctx context.Context, addFields []logger.Field, code int, format string, args ...interface{})

ErrorWithf 错误日志,带用户自定义上报字段 addFields

func Errorf

func Errorf(ctx context.Context, code int, format string, args ...interface{})

Errorf 错误日志

func Fatal

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

Fatal fatal 日志

func FatalWith

func FatalWith(ctx context.Context, addFields []logger.Field, args ...interface{})

FatalWith panic 等崩溃日志,recover时打日志,带用户自定义上报字段 addFields

func FatalWithf

func FatalWithf(ctx context.Context, addFields []logger.Field, format string, args ...interface{})

FatalWithf panic 等崩溃日志,带用户自定义上报字段 addFields

func Fatalf

func Fatalf(ctx context.Context, format string, args ...interface{})

Fatalf fatal 日志

func GetLogger

func GetLogger(msg *codec.Msg) logger.Logger

GetLogger 从上下文中获取logger

func GetTraceback

func GetTraceback() (ret string)

GetTraceback 调用栈

func Info

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

Info 消息日志

func InfoWith

func InfoWith(ctx context.Context, addFields []logger.Field, args ...interface{})

InfoWith 消息日志,带用户自定义上报字段 addFields

func InfoWithf

func InfoWithf(ctx context.Context, addFields []logger.Field, format string, args ...interface{})

InfoWithf 消息日志,带用户自定义上报字段 addFields

func Infof

func Infof(ctx context.Context, format string, args ...interface{})

Infof 消息日志

func Warn

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

Warn 警告日志

func WarnWith

func WarnWith(ctx context.Context, addFields []logger.Field, args ...interface{})

WarnWith 警告日志,带用户自定义上报字段 addFields

func WarnWithf

func WarnWithf(ctx context.Context, addFields []logger.Field, format string, args ...interface{})

WarnWithf 警告日志,带用户自定义上报字段 addFields

func Warnf

func Warnf(ctx context.Context, format string, args ...interface{})

Warnf 警告日志

Types

type TimeLog

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

TimeLog 耗时日志

func NewTimeLog

func NewTimeLog(ctx context.Context, threshold ...time.Duration) *TimeLog

func (*TimeLog) Debug

func (t *TimeLog) Debug(args ...interface{})

Debug debug 带耗时的调试日志

func (*TimeLog) Debugf

func (t *TimeLog) Debugf(format string, args ...interface{})

Debugf debug 带耗时的调试日志

func (*TimeLog) During

func (t *TimeLog) During() time.Duration

During 获取 during

func (*TimeLog) Error

func (t *TimeLog) Error(code int, args ...interface{})

Error 带耗时的错误日志

func (*TimeLog) Errorf

func (t *TimeLog) Errorf(code int, format string, args ...interface{})

Errorf 带耗时的错误日志

func (*TimeLog) Info

func (t *TimeLog) Info(args ...interface{})

Info 带耗时的消息日志

func (*TimeLog) Infof

func (t *TimeLog) Infof(format string, args ...interface{})

Infof 带耗时的消息日志

func (*TimeLog) OverThreshold

func (t *TimeLog) OverThreshold() bool

OverThreshold 判断是否超过阈值

func (*TimeLog) SetThreshold

func (t *TimeLog) SetThreshold(i time.Duration)

SetThreshold 告警阈值,接口化

func (*TimeLog) Start

func (t *TimeLog) Start(ctx context.Context) *TimeLog

Start 新开启一个 TimeLog 重新记时

func (*TimeLog) Warn

func (t *TimeLog) Warn(args ...interface{})

Warn 带耗时的警告日志

func (*TimeLog) Warnf

func (t *TimeLog) Warnf(format string, args ...interface{})

Warnf 带耗时的警告日志

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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