1
0

Added SIGHUP handler for logger file reopening.

This commit is contained in:
Alexander Andreev 2022-05-24 23:34:16 +04:00
parent ec06099d89
commit 6dbe154bbc
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -65,6 +65,18 @@ func main() {
logErr.Fatalln(err)
}
logReload := make(chan os.Signal, 1)
signal.Notify(logReload, syscall.SIGHUP)
go func() {
for {
select {
case <-logReload:
logErr.Reopen(config.Log.Error)
}
}
}()
doneSignal := make(chan os.Signal, 1)
signal.Notify(doneSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)