services: update logs flush after services shutdown

Added sync logs for every service separately to provide the ability to
have a custom logger for each service. This commit makes the code follow
the zap usages rules: `Sync calls the underlying Core's Sync method,
flushing any buffered log entries. Applications should take care to
call Sync before exiting.`

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
Ekaterina Pavlova 2024-02-18 15:29:04 +03:00
parent 9b540770cd
commit 5bb7c6b715
8 changed files with 9 additions and 0 deletions

View file

@ -320,6 +320,8 @@ func (s *Server) Shutdown() {
}
close(s.quit)
<-s.relayFin
_ = s.log.Sync()
}
// AddService allows to add a service to be started/stopped by Server.