logging

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupStandardLogger

func SetupStandardLogger(cfg LogConfig, level logrus.Level, forceColors bool) error

SetupStandardLogger configures the global logger according to the provided configuration. It applies the output destination, log format, rotation policy, and log level used by all components that rely on the default logrus instance (`logrus.StandardLogger()`).

func SubLogger

func SubLogger(base *logrus.Logger, module string, level logrus.Level) *logrus.Entry

SubLogger creates a logrus.Entry object that inherits the formatter, output, and hooks from the given base logger, but can have a different log level and optional module field.

If module == "", no field is added. If level == 0 (panic), the log level is inherited too.

Types

type ExtLogger

type ExtLogger interface {
	logrus.FieldLogger
	Tracef(format string, args ...any)
	Trace(args ...any)
	Traceln(args ...any)
}

ExtLogger is a common interface for logrus.Logger and logrus.Entry. Much like Ext1FieldLogger from logrus.go, it says not to use it, yet it's currently the best option.

type FormatterSyslogHook

type FormatterSyslogHook struct {
	Writer    *syslog.Writer
	Formatter logrus.Formatter
}

func NewFormatterSyslogHook

func NewFormatterSyslogHook(w *syslog.Writer) *FormatterSyslogHook

func (*FormatterSyslogHook) Fire

func (h *FormatterSyslogHook) Fire(entry *logrus.Entry) error

func (*FormatterSyslogHook) Levels

func (*FormatterSyslogHook) Levels() []logrus.Level

type LogConfig

type LogConfig interface {
	GetFormat() string
	GetMedia() string
	NewRotatingLogger(filename string) *lumberjack.Logger
}

type SyslogFormatter

type SyslogFormatter struct{}

func (*SyslogFormatter) Format

func (*SyslogFormatter) Format(e *logrus.Entry) ([]byte, error)

Jump to

Keyboard shortcuts

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