Documentation ¶
Index ¶
- func Debugc(ctx context.Context, msg string, v ...any)
- func Debugf(msg string, v ...any)
- func Enable(l level.Level)
- func EnableLogToFile(jackLog *LogConfig)
- func Errorc(ctx context.Context, msg string, v ...any)
- func Errorf(msg string, v ...any)
- func Fatalc(ctx context.Context, msg string, v ...any)
- func Fatalf(msg string, v ...any)
- func GetFuncName(i interface{}) string
- func GetStructName(i any) string
- func Infoc(ctx context.Context, msg string, v ...any)
- func Infof(msg string, v ...any)
- func IsDebug() bool
- func Jsonify(v any) string
- func JsonifyNoIndent(v interface{}) string
- func PanicError(err error, v ...any)
- func SetLogger(l Logger)
- func SetOutput(w io.Writer)
- func SetSlog()
- func TimeDurationDefer(prefix ...string) func()
- func TimeFuncDuration() func() time.Duration
- func Warnc(ctx context.Context, msg string, v ...any)
- func Warnf(msg string, v ...any)
- func With(c context.Context, msg string, v ...any) context.Context
- func WithLogger(c context.Context, w io.Writer) context.Context
- type ContextLogger
- type FormatLogger
- type LogConfig
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableLogToFile ¶
func EnableLogToFile(jackLog *LogConfig)
func GetFuncName ¶
func GetFuncName(i interface{}) string
func GetStructName ¶
func JsonifyNoIndent ¶
func JsonifyNoIndent(v interface{}) string
func PanicError ¶
func TimeDurationDefer ¶
func TimeDurationDefer(prefix ...string) func()
func TimeFuncDuration ¶
TimeFuncDuration returns the duration consumed by function. It has specified usage like:
f := TimeFuncDuration() DoSomething() duration := f()
func With ¶
With used to store some data in log-ctx Ie supports two forms of writing 1. With(log-ctx, "group") When only msg has a value, it is used as a group 2. With(log-ctx, "key1", "value1") or With(log-ctx, "key1", "value1", "key2", "value2") When msg and v both have values, With resolves them into key-value pairs The parsed results are stored in the LogContext for use by the Logger
Types ¶
type ContextLogger ¶
type FormatLogger ¶ added in v1.0.25
type LogConfig ¶
type LogConfig lumberjack.Logger
func (*LogConfig) SetDefault ¶
func (l *LogConfig) SetDefault()
type Logger ¶
type Logger interface { ContextLogger FormatLogger PanicError(error, ...any) // contains filtered or unexported methods }
Click to show internal directories.
Click to hide internal directories.