Documentation
¶
Index ¶
- func Debug(msg string)
- func Debugf(format string, v ...interface{})
- func Error(msg string)
- func Errorf(format string, v ...interface{})
- func Fatal(msg string)
- func Fatalf(format string, v ...interface{})
- func Info(msg string)
- func Infof(format string, v ...interface{})
- func Init(config *Config)
- func Panic(msg string)
- func Panicf(format string, v ...interface{})
- func Warn(msg string)
- func Warnf(format string, v ...interface{})
- type Config
- type Level
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf logs a formatted fatal message and exits
func Init ¶
func Init(config *Config)
Init initializes the global logger with the given configuration
Types ¶
type Config ¶
type Config struct {
// Level is the minimum log level
Level Level
// Console enables console output
Console bool
// ConsoleJSON enables JSON format for console output
ConsoleJSON bool
// File enables file output
File bool
// Filename is the file to write logs to
Filename string
// MaxSize is the maximum size in megabytes of the log file
MaxSize int
// MaxBackups is the maximum number of old log files to retain
MaxBackups int
// MaxAge is the maximum number of days to retain old log files
MaxAge int
// Compress determines if the rotated log files should be compressed
Compress bool
}
Config holds logger configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns default logger configuration
type Level ¶
type Level int
Level represents log level
const ( // DebugLevel has verbose message DebugLevel Level = iota // InfoLevel is default log level InfoLevel // WarnLevel is for warning conditions WarnLevel // ErrorLevel is for error conditions ErrorLevel // FatalLevel is for fatal conditions FatalLevel // PanicLevel is for panic conditions PanicLevel )
Click to show internal directories.
Click to hide internal directories.