From e8a72dede3096274834f9be41f06e4ca578d36b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20BENO=C3=8ET?= Date: Thu, 11 Feb 2021 23:34:00 +0100 Subject: [PATCH] Add log file hook to logger rather than globally --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index b2a032d..14dd931 100644 --- a/main.go +++ b/main.go @@ -67,7 +67,7 @@ func toLogLevel(cliLevel string) logrus.Level { func configureLogFile(path string) { file, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644) if err == nil { - logrus.AddHook(&lrh_wr.Hook{ + log.Logger.AddHook(&lrh_wr.Hook{ Writer: file, LogLevels: logrus.AllLevels, })