Skip to content

Commit

Permalink
Add debug level logging option
Browse files Browse the repository at this point in the history
This update introduces the ability to enable logging from the caller when the log level is set to "debug". This additional logging feature will provide more specificity and context for debugging tasks, aiding in quicker issue resolution.
  • Loading branch information
Septrum101 committed Dec 29, 2023
1 parent 115d7ba commit 4a234d5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ func run() error {
if err := config.Unmarshal(panelConfig); err != nil {
return fmt.Errorf("Parse config file %v failed: %s \n", cfgFile, err)
}

if panelConfig.LogConfig.Level == "debug" {
log.SetReportCaller(true)
}

p := panel.New(panelConfig)
lastTime := time.Now()
config.OnConfigChange(func(e fsnotify.Event) {
Expand All @@ -88,10 +93,16 @@ func run() error {
if err := config.Unmarshal(panelConfig); err != nil {
log.Panicf("Parse config file %v failed: %s \n", cfgFile, err)
}

if panelConfig.LogConfig.Level == "debug" {
log.SetReportCaller(true)
}

p.Start()
lastTime = time.Now()
}
})

p.Start()
defer p.Close()

Expand Down

0 comments on commit 4a234d5

Please sign in to comment.