From b0d7d8cf8716e3620e85d2300c6f4871ecd755f7 Mon Sep 17 00:00:00 2001 From: Dolf Schimmel Date: Fri, 30 Dec 2016 09:08:13 +0100 Subject: [PATCH] Fix log.Reopen() functionality --- log/log.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/log/log.go b/log/log.go index 0a47862..b9d0e5a 100644 --- a/log/log.go +++ b/log/log.go @@ -14,7 +14,7 @@ type Logger struct { var ( Log *Logger - logFile string + path string ) func Open(name, logLevelStr string) *Logger { @@ -42,20 +42,20 @@ func Open(name, logLevelStr string) *Logger { return Log } - -func Reopen(args string) { - if logFile == "" { +func Reopen() { + if path == "" { Log.Notice("Asked to reopen logs but running in foreground. Ignoring.") return } Log.Notice("Reopening log file per IPC request...") - LogRedirectStdOutToFile(logFile) + LogRedirectStdOutToFile(path) Log.Notice("Reopened log file per IPC request") } // If there are any existing fd's (e.g. we're reopening logs), we rely // on garbage collection to clean them up for us. func LogRedirectStdOutToFile(logPath string) { + path = logPath if logPath == "" { Log.Fatal("Log Path not set") }