Documentation
¶
Index ¶
- Constants
- type Config
- type Logger
- func (l *Logger) Close() error
- func (l *Logger) Debug(v ...any)
- func (l *Logger) Debugf(format string, v ...any)
- func (l *Logger) Debugln(v ...any)
- func (l *Logger) Error(v ...any)
- func (l *Logger) Errorf(format string, v ...any)
- func (l *Logger) Errorln(v ...any)
- func (l *Logger) Fatal(v ...any)
- func (l *Logger) Fatalf(format string, v ...any)
- func (l *Logger) Fatalln(v ...any)
- func (l *Logger) Info(v ...any)
- func (l *Logger) Infof(format string, v ...any)
- func (l *Logger) Infoln(v ...any)
- func (l *Logger) Print(v ...any)
- func (l *Logger) Printf(format string, v ...any)
- func (l *Logger) Println(v ...any)
- func (l *Logger) Trace(v ...any)
- func (l *Logger) Tracef(format string, v ...any)
- func (l *Logger) Traceln(v ...any)
- func (l *Logger) Warn(v ...any)
- func (l *Logger) Warnf(format string, v ...any)
- func (l *Logger) Warnln(v ...any)
Constants ¶
const ( FATAL = "FATAL" ERROR = "ERROR" WARN = "WARN" INFO = "INFO" DEBUG = "DEBUG" TRACE = "TRACE" )
const ( RotationModeNone = "none" RotationModeTime = "time" RotationModeSize = "size" RotationModeTimeAndSize = "time-and-size" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
LogLevel string
OutputPath string
FatalOutputPath string
ErrorOutputPath string
WarnOutputPath string
InfoOutputPath string
DebugOutputPath string
TraceOutputPath string
RotateDaily bool
RotationTime string // format "15:04", local system timezone
RotationMode string // "none", "time", "size", "time-and-size"
MaxSizeBytes int64
RetentionDays int
}
type Logger ¶
func New ¶
New creates a Logger configured with the provided settings.
If cfg.RotateDaily is true and cfg.RotationTime is set, the logger starts a daily rotation goroutine that renames current log files at the configured local time.
func (*Logger) Close ¶
Close stops any active rotation goroutine and closes all open log files.
It returns the first error encountered while closing files, if any.
func (*Logger) Fatalf ¶
Fatalf formats and logs a message at FATAL level before exiting the application.
func (*Logger) Fatalln ¶
Fatalln logs a message at FATAL level with a newline and exits the application.
func (*Logger) Printf ¶
Printf formats and writes a message through the embedded standard logger at INFO level.
func (*Logger) Println ¶
Println writes a message through the embedded standard logger with a newline at INFO level.