diff options
Diffstat (limited to 'pkg/config/logger.go')
-rw-r--r-- | pkg/config/logger.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/config/logger.go b/pkg/config/logger.go index 09d96b7..cb78349 100644 --- a/pkg/config/logger.go +++ b/pkg/config/logger.go @@ -19,10 +19,16 @@ import ( "io" "log" "os" + "path" ) //ConfigureLogger to write logs into a file as well as the stderr func ConfigureLogger(logPath string) (io.Closer, error) { + dir := path.Dir(logPath) + err := os.MkdirAll(dir, 0700) + if err == nil { + log.Println("ERROR: cannot create data dir") + } logFile, err := os.OpenFile(logPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) if err == nil { log.SetOutput(io.MultiWriter(logFile, os.Stderr)) |