module
Version:
v0.1.1
Opens a new window with list of versions in this module.
Published: Jun 27, 2021
License: MIT
Opens a new window with license information.
README
¶
Пакет логгера
LogLevels
- Debug()
LogLevelDbg
- Info()
LogLevelInfo
- Notify()
LogLevelNotify
- Warning()
LogLevelWarning
- Error()
LogLevelError
- Fatal()
LogLevelFatal
- Event()
LogLevelEvent
- Request()
LogLevelRequest
Использование
import "gitlab.com/leolab/go/logger"
var log Logger
func main(){
logCfg:=&LoggerConfig{
DataStore : "sqlite>log",
//:"mysql>user:pass@tcp(127.0.0.1:3306)/dbname?
//:"postrges>host=localhost user=gorm password=gorm port=9920 sslmode=disable TimeZone=Asia/Ekaterinburg"
LoggerPath : "log/log_file",
}
log,err:=NewLogger(&LoggerConfig{});
if err!=nil{
panic(err)
}
log.Debug("Debug level")
log.Notify("Notify level)
log.Info("Information level")
log.Warning("Warning level")
log.Error("Error level")
log.Crit("Critical level")
evt:=map[string]interface{}{
"Source":"main",
"Data":map[string]interface{}{
"Data1":"Some data,
}
}
log.Event("Event record",evt)
req:=map[string]interface{}{}
log.Request("Request record",req)
}
Методы
- NewLogger(*LoggerConfig{}) (*Logger, error)
- Logger{}
- Debug(string, ...interface{})
- Notify(string, ...interface{})
- Info(string, ...interface{})
- Warn(string, ...interface{})
- Error(string, ...interface{})
- Crit(string, ...interface{})
NewLogger()
Logger.Debug()
Logger.Notify()
Logger.Info()
Logger.Warn()
Logger.Error()
Logger.Crit()
Directories
¶
Click to show internal directories.
Click to hide internal directories.