logger

package
v0.0.0-...-ff4e629 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0, Apache-2.0 Imports: 10 Imported by: 62

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, ctx ...Ctx)

Debug logs a message (with optional context) at the DEBUG log level.

func Debugf

func Debugf(format string, args ...any)

Debugf logs at the DEBUG log level using a standard printf format string.

func Error

func Error(msg string, ctx ...Ctx)

Error logs a message (with optional context) at the ERROR log level.

func Errorf

func Errorf(format string, args ...any)

Errorf logs at the ERROR log level using a standard printf format string.

func GetStack

func GetStack() string

GetStack will convert the Go stack into a string suitable for logging.

func Info

func Info(msg string, ctx ...Ctx)

Info logs a message (with optional context) at the INFO log level.

func Infof

func Infof(format string, args ...any)

Infof logs at the INFO log level using a standard printf format string.

func InitLogger

func InitLogger(filepath string, syslogName string, verbose bool, debug bool, hook logrus.Hook) error

InitLogger intializes a full logging instance.

func Panic

func Panic(msg string, ctx ...Ctx)

Panic logs a message (with optional context) at the PANIC log level.

func Panicf

func Panicf(format string, args ...any)

Panicf logs at the PANIC log level using a standard printf format string.

func Pretty

func Pretty(input any) string

Pretty will attempt to convert any Go structure into a string suitable for logging.

func Trace

func Trace(msg string, ctx ...Ctx)

Trace logs a message (with optional context) at the TRACE log level.

func Tracef

func Tracef(format string, args ...any)

Tracef logs at the TRACE log level using a standard printf format string.

func Warn

func Warn(msg string, ctx ...Ctx)

Warn logs a message (with optional context) at the WARNING log level.

func Warnf

func Warnf(format string, args ...any)

Warnf logs at the WARNING log level using a standard printf format string.

Types

type Ctx

type Ctx logrus.Fields

Ctx is the logging context.

type Logger

type Logger interface {
	Panic(msg string, args ...Ctx)
	Fatal(msg string, args ...Ctx)
	Error(msg string, args ...Ctx)
	Warn(msg string, args ...Ctx)
	Info(msg string, args ...Ctx)
	Debug(msg string, args ...Ctx)
	Trace(msg string, args ...Ctx)
	AddContext(Ctx) Logger
}

Logger is the main logging interface.

var Log Logger

Log contains the logger used by all the logging functions.

func AddContext

func AddContext(ctx Ctx) Logger

AddContext returns a new logger with the context added.

Jump to

Keyboard shortcuts

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