mirror of
https://github.com/labring/sealos.git
synced 2026-09-24 15:46:19 +08:00
@@ -25,10 +25,11 @@ import (
|
||||
|
||||
var Debug bool
|
||||
var ConfigDir string
|
||||
var ShowPatch bool
|
||||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
func initConfig() {
|
||||
logger.Cfg(Debug, ConfigDir, "sealctl")
|
||||
logger.Cfg(Debug, ConfigDir, "sealctl", ShowPatch)
|
||||
}
|
||||
|
||||
func InitRootDirectory(rootDirs []string) error {
|
||||
|
||||
@@ -46,4 +46,5 @@ func init() {
|
||||
cobra.OnInitialize(boot.OnBootOnDie)
|
||||
rootCmd.PersistentFlags().StringVar(&boot.ConfigDir, "config", contants.DefaultConfigPath, "config dir (default is $HOME/.sealos)")
|
||||
rootCmd.PersistentFlags().BoolVar(&boot.Debug, "debug", false, "enable debug logger")
|
||||
rootCmd.PersistentFlags().BoolVar(&boot.ShowPatch, "path", false, "enable show code path")
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ import (
|
||||
var Debug bool
|
||||
var ConfigDir string
|
||||
var ConfigFile string
|
||||
|
||||
var ShowPatch bool
|
||||
var ConfigFilePath string
|
||||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
func initConfig() {
|
||||
ConfigFilePath = ConfigDir + ConfigFile
|
||||
logger.Cfg(Debug, ConfigDir, "sealos")
|
||||
logger.Cfg(Debug, ConfigDir, "sealos", ShowPatch)
|
||||
}
|
||||
|
||||
func initRootDirectory() error {
|
||||
|
||||
@@ -48,4 +48,5 @@ func init() {
|
||||
rootCmd.PersistentFlags().StringVar(&boot.ConfigFile, "config-file", contants.DefaultConfigFile, "config file (default is /config.yaml )")
|
||||
|
||||
rootCmd.PersistentFlags().BoolVar(&boot.Debug, "debug", false, "enable debug logger")
|
||||
rootCmd.PersistentFlags().BoolVar(&boot.ShowPatch, "path", false, "enable show code path")
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ func init() {
|
||||
defaultLogger = NewLogger(3)
|
||||
}
|
||||
|
||||
func Cfg(debugMod bool, logDir, name string) {
|
||||
func Cfg(debugMod bool, logDir, name string, showPath bool) {
|
||||
debugMode = debugMod
|
||||
logLev := 5
|
||||
if debugMod {
|
||||
@@ -177,7 +177,7 @@ func Cfg(debugMod bool, logDir, name string) {
|
||||
logLev, logDir, name, time.Now().Format("2006-01-02"),
|
||||
))
|
||||
|
||||
SetLogPath(true)
|
||||
SetLogPath(showPath)
|
||||
}
|
||||
|
||||
func (localLog *LocalLogger) SetLogger(adapterName string, configs ...string) {
|
||||
|
||||
Reference in New Issue
Block a user