fix nil pointer error
This commit is contained in:
parent
1004333534
commit
27fcdad135
9
main.go
9
main.go
|
@ -57,12 +57,14 @@ type LoggersConfig struct {
|
||||||
Appenders map[string]LogAppenderConfig `json:"appenders"`
|
Appenders map[string]LogAppenderConfig `json:"appenders"`
|
||||||
Categories map[string]LogConfig `json:"categories"`
|
Categories map[string]LogConfig `json:"categories"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logger represents a logger instance for a specific category.
|
// Logger represents a logger instance for a specific category.
|
||||||
// It maintains the log level and appenders for that category.
|
// It maintains the log level and appenders for that category.
|
||||||
// Example:
|
// Example:
|
||||||
// logger := GetLogger("mycategory")
|
//
|
||||||
// logger.Info("This is an info message")
|
// logger := GetLogger("mycategory")
|
||||||
// logger.Error("This is an error message")
|
// logger.Info("This is an info message")
|
||||||
|
// logger.Error("This is an error message")
|
||||||
type Logger struct {
|
type Logger struct {
|
||||||
category string
|
category string
|
||||||
level int
|
level int
|
||||||
|
@ -203,4 +205,5 @@ func RegistAppender(typeName string, appenderCreatCb func(LogAppenderConfig) *Lo
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
loggerMap["default"] = defaultLogger
|
loggerMap["default"] = defaultLogger
|
||||||
|
appenders["console"] = &consoleAppender
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue