Fix date format for log files

This commit is contained in:
Daniel 2020-05-25 13:04:16 +02:00
parent eef8a443e4
commit 21405f32d1
2 changed files with 5 additions and 5 deletions

View file

@ -81,7 +81,7 @@ func initControlLogFile() *os.File {
}
// open log file
logFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.log", time.Now().UTC().Format("2006-02-01-15-04-05")))
logFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.log", time.Now().UTC().Format("2006-01-02-15-04-05")))
return initializeLogFile(logFilePath, "control/portmaster-control", info.Version())
}
@ -100,7 +100,7 @@ func logControlError(cErr error) {
}
// open log file
logFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.error.log", time.Now().UTC().Format("2006-02-01-15-04-05")))
logFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.error.log", time.Now().UTC().Format("2006-01-02-15-04-05")))
errorFile := initializeLogFile(logFilePath, "control/portmaster-control", info.Version())
if errorFile == nil {
return
@ -121,7 +121,7 @@ func logControlStack() {
}
// open log file
logFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.stack.log", time.Now().UTC().Format("2006-02-01-15-04-05")))
logFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.stack.log", time.Now().UTC().Format("2006-01-02-15-04-05")))
errorFile := initializeLogFile(logFilePath, "control/portmaster-control", info.Version())
if errorFile == nil {
return

View file

@ -233,13 +233,13 @@ func execute(opts *Options, args []string) (cont bool, err error) {
log.Printf("failed to check/create log file dir %s: %s\n", logFileBasePath, err)
} else {
// open log file
logFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.log", time.Now().UTC().Format("2006-02-01-15-04-05")))
logFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.log", time.Now().UTC().Format("2006-01-02-15-04-05")))
logFile = initializeLogFile(logFilePath, opts.Identifier, file.Version())
if logFile != nil {
defer finalizeLogFile(logFile, logFilePath)
}
// open error log file
errorFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.error.log", time.Now().UTC().Format("2006-02-01-15-04-05")))
errorFilePath := filepath.Join(logFileBasePath, fmt.Sprintf("%s.error.log", time.Now().UTC().Format("2006-01-02-15-04-05")))
errorFile = initializeLogFile(errorFilePath, opts.Identifier, file.Version())
if errorFile != nil {
defer finalizeLogFile(errorFile, errorFilePath)