toast_logger_win/lib.rs
1//! [`ToastLogger`] is a [`log`] crate logger that sends logging output
2//! to the [Windows Toast Notifications].
3//! This is handy when you want to present errors or
4//! a small amount of text to users
5//! from UI-less applications on Windows.
6//!
7//! The following example shows a toast notification saying "Hello, world".
8//! ```no_run
9//! # use toast_logger_win::{Result, ToastLogger};
10//! # fn test() -> Result<()> {
11//! ToastLogger::builder()
12//! .max_level(log::LevelFilter::Error)
13//! .init()?;
14//! log::error!("Hello, world");
15//! # Ok(())
16//! # }
17//! ```
18//! [Windows Toast Notifications]: https://learn.microsoft.com/windows/apps/design/shell/tiles-and-notifications/toast-notifications-overview
19//!
20//! # Features
21//!
22//! * The feature `winrt-toast` switches
23//! the underlying implementation
24//! from the [`windows` crate] to the [`winrt-toast` crate].
25//! Please see the [`Notification`] for more details.
26//!
27//! [`winrt-toast` crate]: https://docs.rs/winrt-toast/latest/winrt_toast/
28//! [`windows` crate]: https://crates.io/crates/windows
29
30#[cfg(not(feature = "winrt-toast"))]
31pub(crate) mod win;
32
33mod error;
34pub use error::{Error, Result};
35mod notification;
36pub use notification::*;
37mod toast_logger;
38pub use toast_logger::*;