diff --git a/internal/intlog/intlog.go b/internal/intlog/intlog.go index 4edf5c2ab..f2675ce91 100644 --- a/internal/intlog/intlog.go +++ b/internal/intlog/intlog.go @@ -37,11 +37,6 @@ func SetEnabled(enabled bool) { } } -// IsEnabled checks and returns whether current process is in GF development. -func IsEnabled() bool { - return isGFDebug -} - // Print prints `v` with newline using fmt.Println. // The parameter `v` can be multiple variables. func Print(v ...interface{}) { diff --git a/os/gcfg/gcfg.go b/os/gcfg/gcfg.go index 423b382df..ff3f7a34d 100644 --- a/os/gcfg/gcfg.go +++ b/os/gcfg/gcfg.go @@ -409,13 +409,12 @@ func (c *Config) getJson(file ...string) *gjson.Json { } } return j - } else { - if errorPrint() { - if filePath != "" { - glog.Criticalf(`[gcfg] Load config file "%s" failed: %s`, filePath, err.Error()) - } else { - glog.Criticalf(`[gcfg] Load configuration failed: %s`, err.Error()) - } + } + if errorPrint() { + if filePath != "" { + glog.Criticalf(`[gcfg] Load config file "%s" failed: %s`, filePath, err.Error()) + } else { + glog.Criticalf(`[gcfg] Load configuration failed: %s`, err.Error()) } } return nil diff --git a/os/gfsnotify/gfsnotify_watcher.go b/os/gfsnotify/gfsnotify_watcher.go index 421b40a59..0088bfaad 100644 --- a/os/gfsnotify/gfsnotify_watcher.go +++ b/os/gfsnotify/gfsnotify_watcher.go @@ -47,7 +47,8 @@ func (w *Watcher) AddOnce(name, path string, callbackFunc func(event *Event), re if err := w.watcher.Add(subPath); err != nil { intlog.Error(err) } else { - intlog.Printf("watcher adds monitor for: %s", subPath) + // It uses `Errorf` as it needs trace stack information here. + intlog.Errorf("watcher adds monitor for: %s", subPath) } } }