diff --git a/config/main.go b/config/main.go index 968d3bf..377b83d 100644 --- a/config/main.go +++ b/config/main.go @@ -15,12 +15,12 @@ var ( func Init() { for _, p := range params { GlobalParams = append(GlobalParams, p) - log.Debugf("loaded config param: \"%s\": \"%s\"", p.Key, p.Val) + log.Infof("loaded config param: \"%s\": \"%s\"", p.Key, p.Val) } for _, s := range switches { GlobalSwitches = append(GlobalSwitches, s) - log.Debugf("loaded config switch: \"%s\": %t", s.Key, s.Val) + log.Infof("loaded config switch: \"%s\": %t", s.Key, s.Val) } } diff --git a/logging/main.go b/logging/main.go index fa28123..98ddd0c 100644 --- a/logging/main.go +++ b/logging/main.go @@ -18,8 +18,9 @@ var ( Log *CTopLogger wg sync.WaitGroup exited bool + level = logging.INFO format = logging.MustStringFormatter( - `%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}`, + `%{color}%{time:15:04:05.000} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}`, ) ) @@ -30,13 +31,17 @@ type CTopLogger struct { func Init() *CTopLogger { if Log == nil { + logging.SetFormatter(format) // setup default formatter + Log = &CTopLogger{ logging.MustGetLogger("ctop"), logging.NewMemoryBackend(size), } - backendFmt := logging.NewBackendFormatter(Log.backend, format) - logging.SetBackend(backendFmt) + backendLvl := logging.AddModuleLevel(Log.backend) + backendLvl.SetLevel(level, "") + + logging.SetBackend(backendLvl) Log.Notice("logger initialized") } return Log