log

package
v0.17.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Caller added in v0.3.8

func Caller(depth int) string

Caller fetches the calling function name, skipping 'depth'.

func Debug added in v0.3.8

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

Debug will log formatted args as 'msg' field to the log at DEBUG level.

func DebugKV added in v0.17.0

func DebugKV(ctx context.Context, key string, value interface{})

DebugKV will log the one key-value field to the log at DEBUG level.

func DebugKVs added in v0.17.0

func DebugKVs(ctx context.Context, kvs ...kv.Field)

DebugKVs will log key-value fields to the log at DEBUG level.

func Debugf added in v0.3.8

func Debugf(ctx context.Context, s string, a ...interface{})

Debugf will log format string as 'msg' field to the log at DEBUG level.

func EnableSyslog added in v0.3.8

func EnableSyslog(proto, addr string) error

EnableSyslog will enabling logging to the syslog at given address.

func Error added in v0.3.8

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

Error will log formatted args as 'msg' field to the log at ERROR level.

func ErrorKV added in v0.17.0

func ErrorKV(ctx context.Context, key string, value interface{})

ErrorKV will log the one key-value field to the log at ERROR level.

func ErrorKVs added in v0.17.0

func ErrorKVs(ctx context.Context, kvs ...kv.Field)

ErrorKVs will log key-value fields to the log at ERROR level.

func Errorf added in v0.3.8

func Errorf(ctx context.Context, s string, a ...interface{})

Errorf will log format string as 'msg' field to the log at ERROR level.

func Hook added in v0.7.1

func Hook(hook func(ctx context.Context, kvs []kv.Field) []kv.Field)

Hook adds the given hook to the global logger context hooks stack.

func Info added in v0.3.8

func Info(ctx context.Context, a ...interface{})

Info will log formatted args as 'msg' field to the log at INFO level.

func InfoKV added in v0.17.0

func InfoKV(ctx context.Context, key string, value interface{})

InfoKV will log the one key-value field to the log at INFO level.

func InfoKVs added in v0.17.0

func InfoKVs(ctx context.Context, kvs ...kv.Field)

InfoKVs will log key-value fields to the log at INFO level.

func Infof added in v0.3.8

func Infof(ctx context.Context, s string, a ...interface{})

Infof will log format string as 'msg' field to the log at INFO level.

func Log added in v0.3.8

func Log(ctx context.Context, lvl LEVEL, a ...interface{})

Log will log formatted args as 'msg' field to the log at given level.

func LogKV added in v0.17.0

func LogKV(ctx context.Context, lvl LEVEL, key string, value interface{})

LogKV will log the one key-value field to the log at given level.

func LogKVs added in v0.17.0

func LogKVs(ctx context.Context, lvl LEVEL, kvs ...kv.Field)

LogKVs will log key-value fields to the log at given level.

func Logf added in v0.3.8

func Logf(ctx context.Context, lvl LEVEL, s string, a ...interface{})

Logf will log format string as 'msg' field to the log at given level.

func Panic added in v0.3.8

func Panic(ctx context.Context, a ...interface{})

Panic will log formatted args as 'msg' field to the log at PANIC level. This will then call panic causing the application to crash.

func PanicKV added in v0.17.0

func PanicKV(ctx context.Context, key string, value interface{})

PanicKV will log the one key-value field to the log at PANIC level. This will then call panic causing the application to crash.

func PanicKVs added in v0.17.0

func PanicKVs(ctx context.Context, kvs ...kv.Field)

PanicKVs will log key-value fields to the log at PANIC level. This will then call panic causing the application to crash.

func Panicf added in v0.3.8

func Panicf(ctx context.Context, s string, a ...interface{})

Panicf will log format string as 'msg' field to the log at PANIC level. This will then call panic causing the application to crash.

func ParseLevel added in v0.3.8

func ParseLevel(str string) error

ParseLevel will parse the log level from given string and set to appropriate LEVEL.

func Print added in v0.3.8

func Print(a ...interface{})

Print will log formatted args to the stdout log output.

func PrintKV added in v0.17.0

func PrintKV(key string, value interface{})

PrintKVs will log the one key-value field to the stdout log output.

func PrintKVs added in v0.17.0

func PrintKVs(kvs ...kv.Field)

PrintKVs will log key-value fields to the stdout log output.

func Printf added in v0.3.8

func Printf(s string, a ...interface{})

Printf will log format string to the stdout log output.

func SetLevel added in v0.3.8

func SetLevel(lvl LEVEL)

SetLevel sets the max logging

func SetTimeFormat added in v0.12.0

func SetTimeFormat(format string)

SetTimeFormat sets the timestamp format to the given string.

func TimeFormat added in v0.12.0

func TimeFormat() string

TimeFormat returns the currently-set timestamp format.

func Trace added in v0.3.8

func Trace(ctx context.Context, a ...interface{})

Trace will log formatted args as 'msg' field to the log at TRACE level.

func TraceKV added in v0.17.0

func TraceKV(ctx context.Context, key string, value interface{})

TraceKV will log the one key-value field to the log at TRACE level.

func TraceKVs added in v0.17.0

func TraceKVs(ctx context.Context, kvs ...kv.Field)

TraceKVs will log key-value fields to the log at TRACE level.

func Tracef added in v0.3.8

func Tracef(ctx context.Context, s string, a ...interface{})

Tracef will log format string as 'msg' field to the log at TRACE level.

func VarDump added in v0.13.0

func VarDump(a any) string

VarDump returns a serialized, useful log / error output of given variable.

func Warn added in v0.3.8

func Warn(ctx context.Context, a ...interface{})

Warn will log formatted args as 'msg' field to the log at WARN level.

func WarnKV added in v0.17.0

func WarnKV(ctx context.Context, key string, value interface{})

WarnKV will log the one key-value field to the log at WARN level.

func WarnKVs added in v0.17.0

func WarnKVs(ctx context.Context, kvs ...kv.Field)

WarnKVs will log key-value fields to the log at WARN level.

func Warnf added in v0.3.8

func Warnf(ctx context.Context, s string, a ...interface{})

Warnf will log format string as 'msg' field to the log at WARN level.

Types

type Entry added in v0.3.8

type Entry struct {
	// contains filtered or unexported fields
}

func New added in v0.6.0

func New() Entry

New starts a new log entry.

func WithContext added in v0.7.1

func WithContext(ctx context.Context) Entry

WithContext returns a new prepared Entry{} with context.

func WithField added in v0.3.8

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

WithField returns a new prepared Entry{} with key-value field.

func WithFields added in v0.3.8

func WithFields(fields ...kv.Field) Entry

WithFields returns a new prepared Entry{} with key-value fields.

func (Entry) Debug added in v0.3.8

func (e Entry) Debug(a ...interface{})

Debug will log formatted args as 'msg' field to the log at DEBUG level.

func (Entry) Debugf added in v0.3.8

func (e Entry) Debugf(s string, a ...interface{})

Debugf will log format string as 'msg' field to the log at DEBUG level.

func (Entry) Error added in v0.3.8

func (e Entry) Error(a ...interface{})

Error will log formatted args as 'msg' field to the log at ERROR level.

func (Entry) Errorf added in v0.3.8

func (e Entry) Errorf(s string, a ...interface{})

Errorf will log format string as 'msg' field to the log at ERROR level.

func (Entry) Info added in v0.3.8

func (e Entry) Info(a ...interface{})

Info will log formatted args as 'msg' field to the log at INFO level.

func (Entry) Infof added in v0.3.8

func (e Entry) Infof(s string, a ...interface{})

Infof will log format string as 'msg' field to the log at INFO level.

func (Entry) Log added in v0.3.8

func (e Entry) Log(lvl LEVEL, a ...interface{})

Log will log formatted args as 'msg' field to the log at given level.

func (Entry) Logf added in v0.3.8

func (e Entry) Logf(lvl LEVEL, s string, a ...interface{})

Logf will log format string as 'msg' field to the log at given level.

func (Entry) Panic added in v0.3.8

func (e Entry) Panic(a ...interface{})

Panic will log formatted args as 'msg' field to the log at PANIC level. This will then call panic causing the application to crash.

func (Entry) Panicf added in v0.3.8

func (e Entry) Panicf(s string, a ...interface{})

Panicf will log format string as 'msg' field to the log at PANIC level. This will then call panic causing the application to crash.

func (Entry) Print added in v0.3.8

func (e Entry) Print(a ...interface{})

Print will log formatted args to the stdout log output.

func (Entry) Printf added in v0.3.8

func (e Entry) Printf(s string, a ...interface{})

Printf will log format string to the stdout log output.

func (Entry) Trace added in v0.3.8

func (e Entry) Trace(a ...interface{})

Trace will log formatted args as 'msg' field to the log at TRACE level.

func (Entry) Tracef added in v0.3.8

func (e Entry) Tracef(s string, a ...interface{})

Tracef will log format string as 'msg' field to the log at TRACE level.

func (Entry) Warn added in v0.3.8

func (e Entry) Warn(a ...interface{})

Warn will log formatted args as 'msg' field to the log at WARN level.

func (Entry) Warnf added in v0.3.8

func (e Entry) Warnf(s string, a ...interface{})

Warnf will log format string as 'msg' field to the log at WARN level.

func (Entry) WithContext added in v0.7.1

func (e Entry) WithContext(ctx context.Context) Entry

WithContext updates Entry{} value context.

func (Entry) WithField added in v0.3.8

func (e Entry) WithField(key string, value interface{}) Entry

WithField appends key-value field to Entry{}.

func (Entry) WithFields added in v0.3.8

func (e Entry) WithFields(kvs ...kv.Field) Entry

WithFields appends key-value fields to Entry{}.

type LEVEL added in v0.17.0

type LEVEL uint8

LEVEL defines a level of logging.

const (
	UNSET LEVEL = 0
	PANIC LEVEL = 1
	ERROR LEVEL = 100
	WARN  LEVEL = 150
	INFO  LEVEL = 200
	DEBUG LEVEL = 250
	TRACE LEVEL = 254
	ALL   LEVEL = ^LEVEL(0)
)

Default levels of logging.

func Level added in v0.3.8

func Level() LEVEL

Level returns the currently set log

func (LEVEL) CanLog added in v0.17.0

func (loglvl LEVEL) CanLog(lvl LEVEL) bool

CanLog returns whether an incoming log of 'lvl' can be logged against receiving level.

Jump to

Keyboard shortcuts

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