logc

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 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 Error

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

Error writes v into error log.

func Errorf

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

Errorf writes v with format into error log.

func Errorv

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

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 ...interface{})

Info writes v into access log.

func Infof

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

Infof writes v with format into access log.

func Infov

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

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 ...interface{})

Slow writes v into slow log.

func Slowf

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

Slowf writes v with format into slow log.

func Slowv

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

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 interface{}) 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