From a06396f0482bb9ffc0f2ff094a7bc57d8e5553a2 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 15 Dec 2023 14:48:41 -0600 Subject: [PATCH] docs: Clarify role of each API item Inspired by #77 --- src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 069ef25..32ee1da 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,13 +53,14 @@ //! } //! ``` //! -//! Or implement [`LogLevel`] yourself for more control. +//! Or implement out [`LogLevel`] trait to customize the default log level and help output. #![cfg_attr(docsrs, feature(doc_auto_cfg))] pub use log::Level; pub use log::LevelFilter; +/// Logging flags to `#[command(flatte)]` into your CLI #[derive(clap::Args, Debug, Clone, Default)] pub struct Verbosity { #[arg( @@ -151,6 +152,7 @@ impl fmt::Display for Verbosity { } } +/// Customize the default log-level and associated help pub trait LogLevel { fn default() -> Option; @@ -171,6 +173,7 @@ pub trait LogLevel { } } +/// Default to [`log::Level::Error`] #[derive(Copy, Clone, Debug, Default)] pub struct ErrorLevel; @@ -180,6 +183,7 @@ impl LogLevel for ErrorLevel { } } +/// Default to [`log::Level::Warn`] #[derive(Copy, Clone, Debug, Default)] pub struct WarnLevel; @@ -189,6 +193,7 @@ impl LogLevel for WarnLevel { } } +/// Default to [`log::Level::Info`] #[derive(Copy, Clone, Debug, Default)] pub struct InfoLevel;