From 35c890048ba62c13bd547285f5a38da0f985c7cd Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Fri, 10 Feb 2023 23:49:12 +0700 Subject: [PATCH] cmd/ctrld: remove prefix main field While at it, also make init logging with empty log path when running start command. Updates #55 --- cmd/ctrld/cli.go | 4 ++++ cmd/ctrld/main.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/ctrld/cli.go b/cmd/ctrld/cli.go index 9e557f4..a5fecf3 100644 --- a/cmd/ctrld/cli.go +++ b/cmd/ctrld/cli.go @@ -207,7 +207,11 @@ func initCLI() { log.Fatalf("failed to unmarshal config: %v", err) } + logPath := cfg.Service.LogPath + cfg.Service.LogPath = "" initLogging() + cfg.Service.LogPath = logPath + processCDFlags() // On Windows, the service will be run as SYSTEM, so if ctrld start as Admin, // the user home dir is different, so pass specific arguments that relevant here. diff --git a/cmd/ctrld/main.go b/cmd/ctrld/main.go index c336a2b..5c55123 100644 --- a/cmd/ctrld/main.go +++ b/cmd/ctrld/main.go @@ -80,7 +80,7 @@ func initLogging() { }) writers = append(writers, consoleWriter) multi := zerolog.MultiLevelWriter(writers...) - mainLog = mainLog.Output(multi).With().Timestamp().Str("prefix", "main").Logger() + mainLog = mainLog.Output(multi).With().Timestamp().Logger() if verbose > 0 || isLog { proxyLog = proxyLog.Output(multi).With().Timestamp().Logger() // TODO: find a better way.