Documentation ¶
Index ¶
Constants ¶
View Source
const ( LogConfigFile = "config.yaml" LogConfigDir = ".slf4go" LogConfigDirEnvVar = "SLF4GO_CONFIG_DIR" LogConfigFileEnvVar = "SLF4GO_CONFIG_FILE" DefaultLoggerName = "default" DefaultLoggerLevel = "INFO" DefaultLoggerWriter = "stderr" )
View Source
const ( TRACE = iota DEBUG INFO WARN ERROR NONE // To entirely disable logging for the Logger DefaultLevel = INFO DefaultFlags = log.Lmsgprefix | log.Ltime | log.Ldate | log.Lshortfile )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Log ¶
var RootLog *Log
RootLog is the default log, it needs to be initialized after the init() function, so that configuration (if any) can be picked up.
type LogConfig ¶
type LogConfig struct {
Loggers map[string]LoggerConfig `yaml:"loggers"`
}
var ( // DefaultLoggerConfigurations is not really a var, but Go is not smart enough // to figure out it's a constant DefaultLoggerConfigurations = LoggerConfig{Level: DefaultLoggerLevel, Writer: DefaultLoggerWriter} LoggersConfiguration LogConfig = LogConfig{ Loggers: map[string]LoggerConfig{ DefaultLoggerName: DefaultLoggerConfigurations, }, } )
type LogLevel ¶
type LogLevel = int8
func UnmarshalLevel ¶
UnmarshalLevel converts a string to a Level. We cannot simply implement the UnmarshalText method, because `LogLevel` (`uint8`)is not considered to be "local"
type Loggable ¶
type Loggable interface {
SetLogLevel(level LogLevel)
}
A Loggable type is one that has a Log and exposes it to its clients
type LoggerConfig ¶
func GetLoggerConfig ¶
func GetLoggerConfig(name string) LoggerConfig
GetLoggerConfig returns the configuration for the given logger; if not specified, it will return the default configuration.
Click to show internal directories.
Click to hide internal directories.