logc

package
v0.0.0-...-9a9fc0b Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGlobalFields

func AddGlobalFields(fields ...LogField)

AddGlobalFields adds global fields.

func Alert

func Alert(_ context.Context, v string)

Alert alerts v in alert level, and the message is written to error log.

func Close

func Close() error

Close closes the logging.

func Debug

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

Debug writes v into access log.

func Debugf

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

Debugf writes v with format into access log.

func Debugv

func Debugv(ctx context.Context, v interface{})

Debugv writes v into access log with json content.

func Debugw

func Debugw(ctx context.Context, msg string, fields ...LogField)

Debugw writes msg along with fields into access log.

func Error

func Error(ctx context.Context, v ...any)

Error writes v into error log.

func Errorf

func Errorf(ctx context.Context, format string, v ...any)

Errorf writes v with format into error log.

func Errorv

func Errorv(ctx context.Context, v any)

Errorv writes v into error log with json content. No call stack attached, because not elegant to pack the messages.

func Errorw

func Errorw(ctx context.Context, msg string, fields ...LogField)

Errorw writes msg along with fields into error log.

func Info

func Info(ctx context.Context, v ...any)

Info writes v into access log.

func Infof

func Infof(ctx context.Context, format string, v ...any)

Infof writes v with format into access log.

func Infov

func Infov(ctx context.Context, v any)

Infov writes v into access log with json content.

func Infow

func Infow(ctx context.Context, msg string, fields ...LogField)

Infow writes msg along with fields into access log.

func Must

func Must(err error)

Must checks if err is nil, otherwise logs the error and exits.

func MustSetup

func MustSetup(c logx.LogConf)

MustSetup sets up logging with given config c. It exits on error.

func SetLevel

func SetLevel(level uint32)

SetLevel sets the logging level. It can be used to suppress some logs.

func SetUp

func SetUp(c LogConf) error

SetUp sets up the logx. If already set up, just 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

func Slow

func Slow(ctx context.Context, v ...any)

Slow writes v into slow log.

func Slowf

func Slowf(ctx context.Context, format string, v ...any)

Slowf writes v with format into slow log.

func Slowv

func Slowv(ctx context.Context, v any)

Slowv writes v into slow log with json content.

func Sloww

func Sloww(ctx context.Context, msg string, fields ...LogField)

Sloww writes msg along with fields into slow log.

Types

type LogConf

type LogConf = logx.LogConf

type LogField

type LogField = logx.LogField

func Field

func Field(key string, value any) LogField

Field returns a LogField for the given key and value.

Jump to

Keyboard shortcuts

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