mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
set default log level to INFO
This commit is contained in:
parent
5419337c17
commit
47360bc8e7
@ -15,12 +15,12 @@ var (
|
|||||||
func Init() {
|
func Init() {
|
||||||
for _, p := range params {
|
for _, p := range params {
|
||||||
GlobalParams = append(GlobalParams, p)
|
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 {
|
for _, s := range switches {
|
||||||
GlobalSwitches = append(GlobalSwitches, s)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,9 @@ var (
|
|||||||
Log *CTopLogger
|
Log *CTopLogger
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
exited bool
|
exited bool
|
||||||
|
level = logging.INFO
|
||||||
format = logging.MustStringFormatter(
|
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 {
|
func Init() *CTopLogger {
|
||||||
if Log == nil {
|
if Log == nil {
|
||||||
|
logging.SetFormatter(format) // setup default formatter
|
||||||
|
|
||||||
Log = &CTopLogger{
|
Log = &CTopLogger{
|
||||||
logging.MustGetLogger("ctop"),
|
logging.MustGetLogger("ctop"),
|
||||||
logging.NewMemoryBackend(size),
|
logging.NewMemoryBackend(size),
|
||||||
}
|
}
|
||||||
|
|
||||||
backendFmt := logging.NewBackendFormatter(Log.backend, format)
|
backendLvl := logging.AddModuleLevel(Log.backend)
|
||||||
logging.SetBackend(backendFmt)
|
backendLvl.SetLevel(level, "")
|
||||||
|
|
||||||
|
logging.SetBackend(backendLvl)
|
||||||
Log.Notice("logger initialized")
|
Log.Notice("logger initialized")
|
||||||
}
|
}
|
||||||
return Log
|
return Log
|
||||||
|
Loading…
Reference in New Issue
Block a user