mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
cmd/cli: set ProxyLogger correctly for interactive commands
The ProxyLogger must only be set after mainLog is fully initialized. However, it's being set before the final initialization of mainlog, causing it still refers to stale old pointer. To fix this, introduce a new function to discard ProxyLogger explicitly, and use this function to init logging for all interactive commands.
This commit is contained in:
committed by
Cuong Manh Le
parent
47d7ace3a7
commit
60686f55ff
@@ -267,8 +267,6 @@ func run(appCallback *AppCallback, stopCh chan struct{}) {
|
||||
// Log config do not have thing to validate, so it's safe to init log here,
|
||||
// so it's able to log information in processCDFlags.
|
||||
logWriters := initLogging()
|
||||
// TODO: find a better way.
|
||||
ctrld.ProxyLogger.Store(mainLog.Load())
|
||||
|
||||
// Initializing internal logging after global logging.
|
||||
p.initInternalLogging(logWriters)
|
||||
@@ -1023,7 +1021,7 @@ func uninstall(p *prog, s service.Service) {
|
||||
{s.Stop, false, "Stop"},
|
||||
{s.Uninstall, true, "Uninstall"},
|
||||
}
|
||||
initLogging()
|
||||
initInteractiveLogging()
|
||||
if doTasks(tasks) {
|
||||
if err := p.router.ConfigureService(svcConfig); err != nil {
|
||||
mainLog.Load().Fatal().Err(err).Msg("could not configure service")
|
||||
|
||||
Reference in New Issue
Block a user