Files
golib/logger
Nicolas JUHEL 54a72a23a5 Update logger for pkg nutsDb + cluster (#105)
# 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
2021-05-26 11:03:44 +02:00
..
2020-07-14 13:28:48 +02:00

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)