mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-27 12:52:27 +02: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
+4
-4
@@ -336,7 +336,7 @@ NOTE: running "ctrld start" without any arguments will start already installed c
|
||||
mainLog.Load().Fatal().Msgf("failed to unmarshal config: %v", err)
|
||||
}
|
||||
|
||||
initLogging()
|
||||
initInteractiveLogging()
|
||||
tasks := []task{
|
||||
{s.Stop, false, "Stop"},
|
||||
resetDnsTask(p, s, isCtrldInstalled, currentIface),
|
||||
@@ -399,7 +399,7 @@ NOTE: running "ctrld start" without any arguments will start already installed c
|
||||
mainLog.Load().Fatal().Msgf("failed to unmarshal config: %v", err)
|
||||
}
|
||||
|
||||
initLogging()
|
||||
initInteractiveLogging()
|
||||
|
||||
if nextdns != "" {
|
||||
removeNextDNSFromArgs(sc)
|
||||
@@ -588,7 +588,7 @@ func initStopCmd() *cobra.Command {
|
||||
p.requiredMultiNICsConfig = ir.All
|
||||
}
|
||||
|
||||
initLogging()
|
||||
initInteractiveLogging()
|
||||
|
||||
status, err := s.Status()
|
||||
if errors.Is(err, service.ErrNotInstalled) {
|
||||
@@ -695,7 +695,7 @@ func initRestartCmd() *cobra.Command {
|
||||
p.requiredMultiNICsConfig = ir.All
|
||||
}
|
||||
|
||||
initLogging()
|
||||
initInteractiveLogging()
|
||||
|
||||
if cdMode {
|
||||
doValidateCdRemoteConfig(cdUID)
|
||||
|
||||
Reference in New Issue
Block a user