log

package
v0.0.0-...-9898e4f Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 15 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugLevel = logrus.DebugLevel
View Source
var ErrorLevel = logrus.ErrorLevel
View Source
var FatalLevel = logrus.FatalLevel
View Source
var InfoLevel = logrus.InfoLevel
View Source
var PanicLevel = logrus.PanicLevel
View Source
var TraceLevel = logrus.TraceLevel
View Source
var WarnLevel = logrus.WarnLevel

Functions

func ConfigureLogger

func ConfigureLogger(conf Logger)

ConfigureLogger configures the global and local logrus logger

func Debug

func Debug(args ...any)

Debug log message

func Debugf

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

Debugf log message

func Debugln

func Debugln(args ...any)

Debugln log message

func Error

func Error(args ...any)

Error log message

func Errorf

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

Errorf log message

func Errorln

func Errorln(args ...any)

Errorln log message

func GetLogger

func GetLogger() *logrus.Logger

GetLogger returns the configured logger instance

func Info

func Info(args ...any)

Info log message

func Infof

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

Infof log message

func Infoln

func Infoln(args ...any)

Infoln log message

func Redf

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

func Warning

func Warning(args ...any)

Warning log message

func Warningf

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

Warningf log message

func Warningln

func Warningln(args ...any)

Warningln log message

Types

type Entry

type Entry = logrus.Entry

Entry is a logrus.Entry

func Sub

func Sub(ns string) *Entry

Sub is a shortcut for log.WithFields(log.Fields{"namespace": ns}), it creates a new logger which inherits the parent's configuration but changes the namespace.

func WithField

func WithField(key string, value any) *Entry

WithField creates an entry from the standard logger and adds a field to it.

func WithFields

func WithFields(fields Fields) *Entry

WithFields creates an entry from the standard logger and adds multiple fields to it.

type Fields

type Fields = logrus.Fields

Fields type, used to pass to `WithFields`.

type JSONFormatConfig

type JSONFormatConfig struct {
	DisableTimestamp bool
	TimestampFormat  string
}

JSONFormatConfig provides configuration for the JSON logger format.

type Logger

type Logger struct {
	Level      string
	Formatter  string
	OutputFile string
	JSONFormat JSONFormatConfig
	TextFormat TextFormatConfig
}

Logger provides configuration for a logger.

func DefaultLoggerConfig

func DefaultLoggerConfig() Logger

DefaultLoggerConfig returns a Logger instance with default values.

type TextFormatConfig

type TextFormatConfig struct {
	// Set to true to bypass checking for a TTY before outputting colors.
	ForceColors bool

	// Force disabling colors.
	DisableColors bool

	// Disable timestamp logging. useful when output is redirected to logging
	// system that already adds timestamps.
	DisableTimestamp bool

	// TimestampFormat to use for display when a full timestamp is printed
	TimestampFormat string

	// The fields are sorted by default for a consistent output. For applications
	// that log extremely frequently and don't use the JSON formatter this may not
	// be desired.
	DisableSorting bool

	Indent string
}

TextFormatConfig provides configuration for the text logger format.

Jump to

Keyboard shortcuts

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