Replace all rlog occurrences with the shared logger (#350)

* Replace all `rlog` occurrences with the shared logger

* Use the same log format in `InitLoggerStderrOnly` as well

* Convert one more `log.Fatal` to `logger.Log.Errorf` as well in the `cli`

* Replace `log.` occurrences with `logger.Log.` in `agent`

* Fix `cannot use err (type error)`

* Change the logging level to `DEBUG`

* Replace an `Errorf` with `Fatal`

* Add informative message
This commit is contained in:
M. Mert Yıldıran
2021-10-17 12:15:30 +03:00
committed by GitHub
parent 91196bb306
commit 147e812edb
15 changed files with 128 additions and 111 deletions

View File

@@ -28,3 +28,14 @@ func InitLogger(logPath string) {
logging.SetBackend(backend1Leveled, backend2Formatter)
}
func InitLoggerStderrOnly() {
consoleLog := logging.NewLogBackend(os.Stderr, "", 0)
backend1Formatter := logging.NewBackendFormatter(consoleLog, format)
backend1Leveled := logging.AddModuleLevel(consoleLog)
backend1Leveled.SetLevel(logging.DEBUG, "")
logging.SetBackend(backend1Leveled, backend1Formatter)
}