Documentation
¶
Index ¶
- func AddGlobalFields(fields ...LogField)
- func Alert(_ context.Context, v string)
- func Close() error
- func Debug(ctx context.Context, v ...interface{})
- func Debugf(ctx context.Context, format string, v ...interface{})
- func Debugfn(ctx context.Context, fn func() any)
- func Debugv(ctx context.Context, v interface{})
- func Debugw(ctx context.Context, msg string, fields ...LogField)
- func Error(ctx context.Context, v ...any)
- func Errorf(ctx context.Context, format string, v ...any)
- func Errorfn(ctx context.Context, fn func() any)
- func Errorv(ctx context.Context, v any)
- func Errorw(ctx context.Context, msg string, fields ...LogField)
- func Info(ctx context.Context, v ...any)
- func Infof(ctx context.Context, format string, v ...any)
- func Infofn(ctx context.Context, fn func() any)
- func Infov(ctx context.Context, v any)
- func Infow(ctx context.Context, msg string, fields ...LogField)
- func Must(err error)
- func MustSetup(c logx.LogConf)
- func SetLevel(level uint32)
- func SetUp(c LogConf) error
- func Slow(ctx context.Context, v ...any)
- func Slowf(ctx context.Context, format string, v ...any)
- func Slowfn(ctx context.Context, fn func() any)
- func Slowv(ctx context.Context, v any)
- func Sloww(ctx context.Context, msg string, fields ...LogField)
- type LogConf
- type LogField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugfn ¶ added in v1.8.0
Debugfn writes fn result into access log. This is useful when the function is expensive to compute, and we want to log it only when necessary.
func Errorfn ¶ added in v1.8.0
Errorfn writes fn result into error log. This is useful when the function is expensive to compute, and we want to log it only when necessary.
func Errorv ¶
Errorv writes v into error log with json content. No call stack attached, because not elegant to pack the messages.
func Infofn ¶ added in v1.8.0
Infofn writes fn result into access log. This is useful when the function is expensive to compute, and we want to log it only when necessary.
func SetLevel ¶
func SetLevel(level uint32)
SetLevel sets the logging level. It can be used to suppress some logs.
func SetUp ¶
SetUp sets up the logx. If already set up, return nil. We allow SetUp to be called multiple times, because, for example, we need to allow different service frameworks to initialize logx respectively. The same logic for SetUp