Add log file hook to logger rather than globally
This commit is contained in:
parent
30cae773cf
commit
e8a72dede3
1 changed files with 1 additions and 1 deletions
2
main.go
2
main.go
|
@ -67,7 +67,7 @@ func toLogLevel(cliLevel string) logrus.Level {
|
||||||
func configureLogFile(path string) {
|
func configureLogFile(path string) {
|
||||||
file, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
|
file, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
logrus.AddHook(&lrh_wr.Hook{
|
log.Logger.AddHook(&lrh_wr.Hook{
|
||||||
Writer: file,
|
Writer: file,
|
||||||
LogLevels: logrus.AllLevels,
|
LogLevels: logrus.AllLevels,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue