cmd/cli: add internal logging

So in case of no logging enabled, useful data could be sent to ControlD
server for further troubleshooting.
This commit is contained in:
Cuong Manh Le
2024-12-09 23:17:00 +07:00
committed by Cuong Manh Le
parent a63a30c76b
commit cd5619a05b
6 changed files with 326 additions and 14 deletions

View File

@@ -1100,6 +1100,8 @@ NOTE: Uninstalling will set DNS to values provided by DHCP.`,
},
}
rootCmd.AddCommand(upgradeCmd)
initLogCmd()
}
// isMobile reports whether the current OS is a mobile platform.
@@ -1231,6 +1233,9 @@ func run(appCallback *AppCallback, stopCh chan struct{}) {
// so it's able to log information in processCDFlags.
initLogging()
// Initializing internal logging after global logging.
p.initInternalLogging()
mainLog.Load().Info().Msgf("starting ctrld %s", curVersion())
mainLog.Load().Info().Msgf("os: %s", osVersion())