Refactor log util (#2276)

This commit is contained in:
Jakub Kołodziejczak 2024-07-16 11:50:35 +02:00 committed by GitHub
parent 1d6f5482dd
commit f9c59a7131
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -19,9 +19,9 @@ func InitLog(logLevel string, logPath string) error {
log.Errorf("Failed parsing log-level %s: %s", logLevel, err) log.Errorf("Failed parsing log-level %s: %s", logLevel, err)
return err return err
} }
custom_outputs := []string{"console", "syslog"}; customOutputs := []string{"console", "syslog"};
if logPath != "" && !slices.Contains(custom_outputs, logPath) { if logPath != "" && !slices.Contains(customOutputs, logPath) {
lumberjackLogger := &lumberjack.Logger{ lumberjackLogger := &lumberjack.Logger{
// Log file absolute path, os agnostic // Log file absolute path, os agnostic
Filename: filepath.ToSlash(logPath), Filename: filepath.ToSlash(logPath),

View File

@ -1,3 +1,6 @@
package util package util
func AddSyslogHook() {} func AddSyslogHook() {
// The syslog package is not available for Windows. This adapter is needed
// to handle windows build.
}