Files
golib/logger/README.md
Nicolas JUHEL 55affe9e7c - Add some README.md
- Fix some error
- Refactor dependancies + bump dependancies
- Change repos README.md
2020-07-14 13:28:48 +02:00

857 B

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)