log

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: BSD-3-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	LevelError uint32
	LevelWarn
	LevelInfo
	LevelDebug
)

Variables

This section is empty.

Functions

func Close

func Close()

Close waiting for all messages to finish recording

func Debugf

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

Debugf debug message

func Errorf

func Errorf(format string, args ...interface{})

Errorf error message

func Fatalf

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

Fatalf fatal message and exit

func GetLevel

func GetLevel() uint32

GetLevel getting log level

func Infof

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

Infof info message

func SetLevel

func SetLevel(v uint32)

SetLevel change log level

func SetOutput

func SetOutput(out io.Writer)

SetOutput change writer

func Warnf

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

Warnf warning message

Types

type Fields

type Fields map[string]interface{}

type Logger

type Logger interface {
	SetOutput(out io.Writer)
	SetLevel(v uint32)
	GetLevel() uint32
	Close()

	WriterContext
}

Logger base interface

func Default

func Default() Logger

Default logger

func New

func New() Logger

New init new logger

type Sender

type Sender interface {
	PutEntity(v *entity)
	SendMessage(level uint32, call func(v *message))
	Close()
}

type Writer

type Writer interface {
	Fatalf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Debugf(format string, args ...interface{})
}

Writer writer interface

func WithError

func WithError(key string, err error) Writer

WithError setter context to log message

func WithField

func WithField(key string, value interface{}) Writer

WithField setter context to log message

func WithFields

func WithFields(v Fields) Writer

WithFields setter context to log message

type WriterContext

type WriterContext interface {
	WithError(key string, err error) Writer
	WithField(key string, value interface{}) Writer
	WithFields(Fields) Writer
	Writer
}

Jump to

Keyboard shortcuts

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