See kite inside of the source code, there is a piece of coding very interesting.
On the code first:
//Setupsignalhandler listens to signals and toggles the log level to DEBUG//mode when it received a SIGUSR2 signal. Another SIGUSR2 toggles the log//Level back to the old level .Func (k *Kite) Setupsignalhandler () {c:= Make (Chan os. Signal,1) signal. Notify (c, Syscall. SIGUSR2) go func () { forS: =range C {k.log.info ("Got signal:%s", s)ifDebugMode {//Toogle back-to-old settings.K.log.info ("Disabling debug mode") ifK.setloglevel = =Nil {k.log.error ("Setloglevel is not defined") Continue} k.setloglevel (Getloglevel ()) DebugMode=false } Else{k.log.info ("Enabling debug Mode") ifK.setloglevel = =Nil {k.log.error ("Setloglevel is not defined") Continue} k.setloglevel (DEBUG) DebugMode=true } } }()}
You can toggle the log mode by giving the program that is running.
Extrapolate, you can use this method to do a lot of switching switching.
Interesting code--switching log mode with system signals