logger

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level represents the log severity level.

const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
)

func ParseLevel

func ParseLevel(s string) Level

ParseLevel converts a string to a Level.

func (Level) String

func (l Level) String() string

type Logger

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

Logger provides structured file-based logging with daily rotation.

func New

func New(logDir string, retentionDays int) *Logger

New creates a new Logger instance.

func (*Logger) Cleanup

func (l *Logger) Cleanup()

Cleanup removes log files older than retentionDays.

func (*Logger) Close

func (l *Logger) Close()

Close closes the current log file.

func (*Logger) Debug

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

Debug logs a message at DEBUG level.

func (*Logger) Error

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

Error logs a message at ERROR level.

func (*Logger) Info

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

Info logs a message at INFO level.

func (*Logger) SetConsole

func (l *Logger) SetConsole(enabled bool)

SetConsole enables or disables console output.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level Level)

SetLevel sets the minimum log level.

func (*Logger) Warn

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

Warn logs a message at WARN level.

Jump to

Keyboard shortcuts

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