gologger/test/main.go

44 lines
817 B
Go
Raw Normal View History

2023-11-28 18:29:30 +08:00
package main
import (
logger "git.pyer.club/kingecg/gologger"
)
2024-09-21 22:41:52 +08:00
func aqmain() {
2023-11-28 18:29:30 +08:00
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")
}