From 91e2b22016fd1dc2531cf345f3a3bb5ad478d4b9 Mon Sep 17 00:00:00 2001 From: Jonathan Chappelow Date: Thu, 2 Nov 2023 17:25:48 -0500 Subject: [PATCH] kwild/config: rootify relative log paths --- cmd/kwild/config/config.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/kwild/config/config.go b/cmd/kwild/config/config.go index 35836f48e..8278db586 100644 --- a/cmd/kwild/config/config.go +++ b/cmd/kwild/config/config.go @@ -296,10 +296,20 @@ func DefaultConfig() *KwildConfig { } func (cfg *KwildConfig) LogConfig() *log.Config { + // Rootify any relative paths. + outputPaths := make([]string, 0, len(cfg.Logging.OutputPaths)) + for _, path := range cfg.Logging.OutputPaths { + switch path { + case "stdout", "stderr": + outputPaths = append(outputPaths, path) + default: + outputPaths = append(outputPaths, rootify(path, cfg.RootDir)) + } + } // log.Config <== config.Logging return &log.Config{ Level: cfg.Logging.Level, - OutputPaths: cfg.Logging.OutputPaths, + OutputPaths: outputPaths, Format: cfg.Logging.Format, EncodeTime: cfg.Logging.TimeEncoding, }