Emit graceful shutdown info in all cases

This commit is contained in:
Hirrolot 2021-06-27 16:36:36 +06:00
parent a6c480930a
commit c5ac8b5f9c
2 changed files with 7 additions and 5 deletions

View file

@ -326,7 +326,7 @@ where
self.shutdown_notify_back.notify_waiters();
log::info!("Dispatching has been shut down.");
} else {
log::debug!("Dispatching has been stopped (listener returned `None`).");
log::info!("Dispatching has been stopped (listener returned `None`).");
}
self.state.store(Idle);
@ -489,8 +489,10 @@ impl ShutdownToken {
/// If you don't need to wait for shutdown, the returned future can be
/// ignored.
pub fn shutdown(&self) -> Result<impl Future<Output = ()> + '_, IdleShutdownError> {
shutdown_inner(&self.dispatcher_state)
.map(|()| async move { self.shutdown_notify_back.notified().await })
shutdown_inner(&self.dispatcher_state).map(|()| async move {
log::info!("Trying to shutdown the dispatcher...");
self.shutdown_notify_back.notified().await
})
}
}

View file

@ -23,8 +23,8 @@ macro_rules! enable_logging {
/// Enables logging through [pretty-env-logger] with a custom filter for your
/// program.
///
/// A logger will **only** print errors from teloxide and restrict logs from
/// your program by the specified filter.
/// A logger will **only** print errors, warnings, and general information from
/// teloxide and restrict logs from your program by the specified filter.
///
/// # Example
/// Allow printing all logs from your program up to [`LevelFilter::Debug`] (i.e.