mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
cmd/cli: ignore log file config for interactive logging
Otherwise, the interactive commands may clobber the existed log file of ctrld daemon, causing it stops writing log until restarted.
This commit is contained in:
committed by
Cuong Manh Le
parent
398f71fd00
commit
caf98b4dfe
@@ -108,8 +108,14 @@ func initLogging() []io.Writer {
|
||||
|
||||
// initInteractiveLogging is like initLogging, but the ProxyLogger is discarded
|
||||
// to be used for all interactive commands.
|
||||
//
|
||||
// Current log file config will also be ignored.
|
||||
func initInteractiveLogging() {
|
||||
initLogging()
|
||||
old := cfg.Service.LogPath
|
||||
cfg.Service.LogPath = ""
|
||||
zerolog.TimeFieldFormat = time.RFC3339 + ".000"
|
||||
initLoggingWithBackup(false)
|
||||
cfg.Service.LogPath = old
|
||||
l := zerolog.New(io.Discard)
|
||||
ctrld.ProxyLogger.Store(&l)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user