simplify log shutdown.

This commit is contained in:
Miroslav Šedivý 2021-10-24 18:31:16 +02:00
parent a5adca1399
commit 3b5d6b2ec5

View File

@ -145,35 +145,22 @@ func (neko *Neko) Start() {
} }
func (neko *Neko) Shutdown() { func (neko *Neko) Shutdown() {
if err := neko.broadcastManager.Shutdown(); err != nil { var err error
neko.logger.Err(err).Msg("broadcast manager shutdown with an error")
} else {
neko.logger.Debug().Msg("broadcast manager shutdown")
}
if err := neko.remoteManager.Shutdown(); err != nil { err = neko.broadcastManager.Shutdown()
neko.logger.Err(err).Msg("remote manager shutdown with an error") neko.logger.Err(err).Msg("broadcast manager shutdown")
} else {
neko.logger.Debug().Msg("remote manager shutdown")
}
if err := neko.webRTCManager.Shutdown(); err != nil { err = neko.remoteManager.Shutdown()
neko.logger.Err(err).Msg("webrtc manager shutdown with an error") neko.logger.Err(err).Msg("remote manager shutdown")
} else {
neko.logger.Debug().Msg("webrtc manager shutdown")
}
if err := neko.webSocketHandler.Shutdown(); err != nil { err = neko.webRTCManager.Shutdown()
neko.logger.Err(err).Msg("websocket handler shutdown with an error") neko.logger.Err(err).Msg("webrtc manager shutdown")
} else {
neko.logger.Debug().Msg("websocket handler shutdown")
}
if err := neko.server.Shutdown(); err != nil { err = neko.webSocketHandler.Shutdown()
neko.logger.Err(err).Msg("server shutdown with an error") neko.logger.Err(err).Msg("websocket handler shutdown")
} else {
neko.logger.Debug().Msg("server shutdown") err = neko.server.Shutdown()
} neko.logger.Err(err).Msg("server shutdown")
} }
func (neko *Neko) ServeCommand(cmd *cobra.Command, args []string) { func (neko *Neko) ServeCommand(cmd *cobra.Command, args []string) {