log

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(msg string, args ...any)

func Debug

func Debug(msg string, args ...any)

func Error

func Error(msg string, args ...any)

func Info

func Info(msg string, args ...any)

func Initialize

func Initialize(logLevel Level, serviceName string, formatterArgs ...logrus.Formatter)

Initialize initializes the package logger. It accepts an optional logrus.Formatter as the third parameter. If none is provided, it defaults to JSONFormatter. The variadic parameter keeps the function backward compatible with existing two-argument calls.

func Panic

func Panic(msg string, args ...any)

func Warning

func Warning(msg string, args ...any)

Types

type Code

type Code int
const (
	OK Code = iota + 1
	ClientError
	ServerError
	UnknownCode
)

func (Code) String

func (c Code) String() string

type Event

type Event int
const (
	Request Event = iota + 1
	Response
	UnknownEvent
)

func (Event) String

func (e Event) String() string

type Level

type Level string
const (
	LevelPanic Level = "PANIC"
	LevelFatal Level = "FATAL"
	LevelError Level = "ERROR"
	LevelWarn  Level = "WARN"
	LevelInfo  Level = "INFO"
	LevelDebug Level = "DEBUG"
	LevelTrace Level = "TRACE"
)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func WithError

func WithError(err error) *Logger

func WithField

func WithField(key string, value any) *Logger

func WithFields

func WithFields(args map[string]any) *Logger

func (*Logger) Alert

func (l *Logger) Alert(msg string, args ...any)

func (*Logger) Debug

func (l *Logger) Debug(msg string, args ...any)

func (*Logger) Error

func (l *Logger) Error(msg string, args ...any)

func (*Logger) Info

func (l *Logger) Info(msg string, args ...any)

func (*Logger) Panic

func (l *Logger) Panic(msg string, args ...any)

func (*Logger) Warning

func (l *Logger) Warning(msg string, args ...any)

func (*Logger) WithError

func (l *Logger) WithError(err error) *Logger

func (*Logger) WithField

func (l *Logger) WithField(key string, value any) *Logger

func (*Logger) WithFields

func (l *Logger) WithFields(args map[string]any) *Logger

type Severity

type Severity int

--------------- ENUMERATIONS ---------------

const (
	DEBUG Severity = iota + 1
	INFO
	WARNING
	ERROR
	ALERT
	PANIC
	UNKNOWN_SEVERITY
)

func (Severity) String

func (s Severity) String() string

type Tracer

type Tracer struct {
	// contains filtered or unexported fields
}

func NewTracer

func NewTracer(ctx context.Context, methodName, serviceName string) *Tracer

func (*Tracer) Alert

func (t *Tracer) Alert(code Code, event Event, err error, msg string, args ...any)

func (*Tracer) Debug

func (t *Tracer) Debug(code Code, event Event, msg string, args ...any)

func (*Tracer) Error

func (t *Tracer) Error(code Code, event Event, err error, msg string, args ...any)

func (*Tracer) Info

func (t *Tracer) Info(code Code, event Event, msg string, args ...any)

func (*Tracer) Panic

func (t *Tracer) Panic(code Code, event Event, err error, msg string, args ...any)

func (*Tracer) TraceRequest

func (t *Tracer) TraceRequest(err error)

func (*Tracer) TraceResponse

func (t *Tracer) TraceResponse(err error)

func (*Tracer) Warning

func (t *Tracer) Warning(code Code, event Event, msg string, args ...any)

func (*Tracer) WithField

func (t *Tracer) WithField(key string, value any) *Tracer

func (*Tracer) WithFields

func (t *Tracer) WithFields(fields map[string]any) *Tracer

Jump to

Keyboard shortcuts

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