gologger/test/main.go

44 lines
815 B
Go

package main
import (
logger "git.pyer.club/kingecg/gologger"
)
func main() {
logger.Configure(logger.LoggersConfig{
Categories: map[string]logger.LogConfig{
"default": {
Level: "debug",
Appenders: []string{
"console",
},
},
"fat": {
Level: "debug",
Appenders: []string{
"console",
"file",
},
},
},
Appenders: map[string]logger.LogAppenderConfig{
"console": {
Type: "console",
},
"file": {
Type: "file",
Options: map[string]interface{}{
"file": "./log/fat.log",
},
},
},
})
defaultLogger := logger.GetLogger("default")
defaultLogger.Debug("debug")
fatLogger := logger.GetLogger("fat")
fatLogger.Debug("debug")
defaultLogger.Debug("debug again")
fatLogger.Debug("debug again")
fatLogger.Error("This is error")
}