log

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crit

func Crit(msg string, ctx ...interface{})

Crit is a convenient alias for Root().Crit

func Critf

func Critf(msg string, ctx ...interface{})

Critf is a convenient alias for Root().Crit

func Debug

func Debug(msg string, ctx ...interface{})

Debug is a convenient alias for Root().Debug

func Debugf

func Debugf(msg string, ctx ...interface{})

func Error

func Error(msg string, ctx ...interface{})

Error is a convenient alias for Root().Error

func Errorf

func Errorf(msg string, ctx ...interface{})

Errorf is a convenient alias for Root().Error

func Info

func Info(msg string, ctx ...interface{})

Info is a convenient alias for Root().Info

func Infof

func Infof(msg string, ctx ...interface{})

Infof is a convenient alias for Root().Info

func Init

func Init(nodeConfig conf.NodeConfig, config conf.LoggerConfig)

func InitMobileLogger

func InitMobileLogger(filepath string, isDebug bool)

func Trace

func Trace(msg string, ctx ...interface{})

Trace is a convenient alias for Root().Trace

func Tracef

func Tracef(msg string, ctx ...interface{})

func Warn

func Warn(msg string, ctx ...interface{})

Warn is a convenient alias for Root().Warn

func Warnf

func Warnf(msg string, ctx ...interface{})

Warnf is a convenient alias for Root().Warn

Types

type Ctx

type Ctx map[string]interface{}

Ctx is a map of key/value pairs to pass as context to a log function Use this only if you really need greater safety around the arguments you pass to the logging functions.

type Logger

type Logger interface {
	// New returns a new Logger that has this logger's context plus the given context
	New(ctx ...interface{}) Logger

	// Log a message at the given level with context key/value pairs
	Trace(msg string, ctx ...interface{})
	Debug(msg string, ctx ...interface{})
	Info(msg string, ctx ...interface{})
	Warn(msg string, ctx ...interface{})
	Error(msg string, ctx ...interface{})
	Crit(msg string, ctx ...interface{})
}

A Logger writes key/value pairs to a Handler

func New

func New(ctx ...interface{}) Logger

New returns a new logger with the given context. New is a convenient alias for Root().New

func Root

func Root() Logger

Root returns the root logger

type Lvl

type Lvl int
const (
	LvlCrit Lvl = iota
	LvlFatal
	LvlError
	LvlWarn
	LvlInfo
	LvlDebug
	LvlTrace
)

type TerminalStringer

type TerminalStringer interface {
	TerminalString() string
}

TerminalStringer is an analogous interface to the stdlib stringer, allowing own types to have custom shortened serialization formats when printed to the screen.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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