logger

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CtxKeyLogID = "U_LOGID"
)

Variables

This section is empty.

Functions

func Debug

func Debug(format string, args ...interface{})

func DebugX

func DebugX(field string, format string, args ...interface{})

func Error

func Error(format string, args ...interface{})

func ErrorX

func ErrorX(field string, format string, args ...interface{})

func Fatal

func Fatal(format string, args ...interface{})

func FatalX

func FatalX(field string, format string, args ...interface{})

func FlushLog

func FlushLog()

FlushLog flushes any buffered log entries

func GetLogID

func GetLogID(ctx context.Context) string

func Info

func Info(format string, args ...interface{})

func InfoX

func InfoX(field string, format string, args ...interface{})

func InitLog

func InitLog(output string) (err error)

func Warn

func Warn(format string, args ...interface{})

func WarnX

func WarnX(field string, format string, args ...interface{})

Types

type ConsoleHook

type ConsoleHook struct {
	Writer    io.Writer
	Formatter logrus.Formatter
}

func (*ConsoleHook) Fire

func (hook *ConsoleHook) Fire(entry *logrus.Entry) error

func (*ConsoleHook) Levels

func (hook *ConsoleHook) Levels() []logrus.Level

type FileHook

type FileHook struct {
	Writer    io.Writer
	Formatter logrus.Formatter
}

func (*FileHook) Fire

func (hook *FileHook) Fire(entry *logrus.Entry) error

func (*FileHook) Levels

func (hook *FileHook) Levels() []logrus.Level

type Logger

type Logger struct {
	*logrus.Logger
}

func NewLogger

func NewLogger(filename string) (*Logger, error)

func (*Logger) FlushLog

func (l *Logger) FlushLog()

FlushLog flushes any buffered log entries

func (*Logger) GetLogID

func (l *Logger) GetLogID(ctx context.Context) string

type RotateHook

type RotateHook struct {
	Filename   string
	MaxSize    int64
	MaxBackups int
	MaxAge     int
	LocalTime  bool
	// contains filtered or unexported fields
}

func NewRotateHook

func NewRotateHook(filename string) *RotateHook

func (*RotateHook) Fire

func (hook *RotateHook) Fire(entry *logrus.Entry) error

func (*RotateHook) Levels

func (hook *RotateHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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