mirror of
https://github.com/daeuniverse/dae.git
synced 2025-01-20 17:33:41 +07:00
feat: allow to change log level by reloading
This commit is contained in:
parent
8d29a81626
commit
215b9202ea
@ -95,6 +95,7 @@ loop:
|
||||
switch sig {
|
||||
case nil:
|
||||
if reloading {
|
||||
// Serve.
|
||||
reloading = false
|
||||
log.Warnln("[Reload] Serve")
|
||||
readyChan := make(chan bool, 1)
|
||||
@ -108,6 +109,7 @@ loop:
|
||||
sdnotify.Ready()
|
||||
log.Warnln("[Reload] Finished")
|
||||
} else {
|
||||
// Listening error.
|
||||
break loop
|
||||
}
|
||||
case syscall.SIGUSR1:
|
||||
@ -115,6 +117,7 @@ loop:
|
||||
log.Warnln("[Reload] Received reload signal; prepare to reload")
|
||||
sdnotify.Reloading()
|
||||
|
||||
// Load new config.
|
||||
log.Warnln("[Reload] Load new config")
|
||||
conf, includes, err := readConfig(cfgFile)
|
||||
if err != nil {
|
||||
@ -125,7 +128,11 @@ loop:
|
||||
continue
|
||||
}
|
||||
log.Infof("Include config files: [%v]", strings.Join(includes, ", "))
|
||||
// New logger.
|
||||
log = logger.NewLogger(conf.Global.LogLevel, disableTimestamp)
|
||||
logrus.SetLevel(log.Level)
|
||||
|
||||
// New control plane.
|
||||
obj := c.EjectBpf()
|
||||
log.Warnln("[Reload] Load new control plane")
|
||||
newC, err := newControlPlane(log, obj, conf)
|
||||
|
Loading…
Reference in New Issue
Block a user