Reverse the coupling of module log and config #1606
|
@ -88,9 +88,8 @@ func GetLogWriter(logfmt string, logfile string) (writer io.Writer) {
|
|||
writer = os.Stdout // Set the default case to prevent nil pointer panics
|
||||
switch logfmt {
|
||||
case "file":
|
||||
err := os.Mkdir(logPath, 0744)
|
||||
if err != nil && !os.IsExist(err) {
|
||||
Fatalf("Could not create log folder: %s", err.Error())
|
||||
if err := os.MkdirAll(logPath, 0744); err != nil {
|
||||
Fatalf("Could not create log path: %s", err.Error())
|
||||
}
|
||||
fullLogFilePath := logPath + "/" + logfile + ".log"
|
||||
f, err := os.OpenFile(fullLogFilePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0600)
|
||||
|
|
Loading…
Reference in New Issue
Block a user