mirror of
https://github.com/nabbar/golib.git
synced 2025-12-24 11:51:02 +08:00
# Package NutsDB - Implement new logger into NutsDB package - Optimize concurrent work for package NutsDB # Package Cluster - Change logger into cluster - Change SetLoggerFactory : no more init call # Package Logger - Fix error into logger with logrus logger dup : level not included in dup function
Logger pakcage
Help manage logger. This package does not implement a logger but user logrus as logger behind.
This package will simplify call of logger and allow more features like *log.Logger wrapper.
Exmaple of implement
In your file, first add the import of golib/logger :
import . "github.com/nabbar/golib/logger"
// Check if the function call will return an error, and if so, will log a fatal (log and os.exit) message
FatalLevel.LogError(GetVersion().CheckGo("1.12", ">="))
This call, will disable color, trace,
FileTrace(false)
DisableColor()
EnableViperLog(true)
This call, return a go *log.Logger interface. This example can be found in the golib/httpserver package :
log := GetLogger(ErrorLevel, log.LstdFlags|log.Lmicroseconds, "[http/http2 server '%s']", host)