logger

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fatalf

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

Middleware functions for global access if needed

func Init

func Init(config Config) error

Init initializes the global logger with the provided configuration

Types

type Config

type Config struct {
	Level      string `mapstructure:"level"`
	Format     string `mapstructure:"format"`
	Module     string `mapstructure:"module"`
	MaxSize    int    `mapstructure:"max_size"`
	MaxAge     int    `mapstructure:"max_age"`
	MaxBackups int    `mapstructure:"max_backups"`
	Compress   bool   `mapstructure:"compress"`
}

Configuration for the logger

type Fields

type Fields = logrus.Fields

Fields type is an alias for logrus.Fields

type Logger

type Logger struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

Logger is a wrapper around logrus.Logger

func NewLogger

func NewLogger(module string) *Logger

NewLogger creates a new logger instance with the specified module

func (*Logger) Debug

func (l *Logger) Debug(args ...any)

Debug logs a message at the debug level

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...any)

Debugf logs a formatted message at the debug level

func (*Logger) Error

func (l *Logger) Error(args ...any)

Error logs a message at the error level

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...any)

Errorf logs a formatted message at the error level

func (*Logger) Fatal

func (l *Logger) Fatal(args ...any)

Fatal logs a message at the fatal level and then exits

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...any)

Fatalf logs a formatted message at the fatal level and then exits

func (*Logger) Info

func (l *Logger) Info(args ...any)

Info logs a message at the info level

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...any)

Infof logs a formatted message at the info level

func (*Logger) Warn

func (l *Logger) Warn(args ...any)

Warn logs a message at the warn level

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...any)

Warnf logs a formatted message at the warn level

func (*Logger) WithError

func (l *Logger) WithError(err error) *logrus.Entry

WithError adds an error to the logger

func (*Logger) WithFields

func (l *Logger) WithFields(fields Fields) *logrus.Entry

WithFields adds fields to the logger

Jump to

Keyboard shortcuts

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