pub enum LogLevel {
Silent,
Error,
Warn,
Info,
Debug,
Trace,
}Expand description
Logging level for controlling verbosity.
Controls what logs are written to stderr. This is completely independent of the output format (stdout).
§Examples
use sublime_cli_tools::cli::LogLevel;
let level = LogLevel::Info;
let tracing_level = level.to_tracing_level();
assert_eq!(tracing_level, tracing::Level::INFO);Variants§
Silent
No logs at all.
Complete silence on stderr. Useful for automation where only stdout output is desired.
Error
Only critical errors.
Shows only errors that prevent command execution.
Warn
Errors and warnings.
Shows errors and important warnings.
Info
General progress information.
Shows high-level progress and completion messages. This is the default level.
Debug
Detailed operation logs.
Shows internal operations and decision points. Useful for troubleshooting.
Trace
Very verbose debugging.
Shows all internal operations including low-level details. Use for deep debugging only.
Implementations§
Source§impl LogLevel
impl LogLevel
Sourcepub const fn to_tracing_level(&self) -> Level
pub const fn to_tracing_level(&self) -> Level
Converts to a tracing Level.
Note: Silent is mapped to ERROR but should be filtered out during logger initialization.
§Examples
use sublime_cli_tools::cli::LogLevel;
assert_eq!(LogLevel::Info.to_tracing_level(), tracing::Level::INFO);
assert_eq!(LogLevel::Debug.to_tracing_level(), tracing::Level::DEBUG);
assert_eq!(LogLevel::Trace.to_tracing_level(), tracing::Level::TRACE);Sourcepub const fn is_silent(&self) -> bool
pub const fn is_silent(&self) -> bool
Returns true if this is silent mode.
§Examples
use sublime_cli_tools::cli::LogLevel;
assert!(LogLevel::Silent.is_silent());
assert!(!LogLevel::Info.is_silent());Sourcepub const fn includes_errors(&self) -> bool
pub const fn includes_errors(&self) -> bool
Returns true if this level includes error logs.
§Examples
use sublime_cli_tools::cli::LogLevel;
assert!(LogLevel::Error.includes_errors());
assert!(LogLevel::Info.includes_errors());
assert!(!LogLevel::Silent.includes_errors());Sourcepub const fn includes_warnings(&self) -> bool
pub const fn includes_warnings(&self) -> bool
Returns true if this level includes warning logs.
§Examples
use sublime_cli_tools::cli::LogLevel;
assert!(LogLevel::Warn.includes_warnings());
assert!(LogLevel::Info.includes_warnings());
assert!(!LogLevel::Error.includes_warnings());Sourcepub const fn includes_info(&self) -> bool
pub const fn includes_info(&self) -> bool
Returns true if this level includes info logs.
§Examples
use sublime_cli_tools::cli::LogLevel;
assert!(LogLevel::Info.includes_info());
assert!(LogLevel::Debug.includes_info());
assert!(!LogLevel::Warn.includes_info());Sourcepub const fn includes_debug(&self) -> bool
pub const fn includes_debug(&self) -> bool
Returns true if this level includes debug logs.
§Examples
use sublime_cli_tools::cli::LogLevel;
assert!(LogLevel::Debug.includes_debug());
assert!(LogLevel::Trace.includes_debug());
assert!(!LogLevel::Info.includes_debug());Sourcepub const fn includes_trace(&self) -> bool
pub const fn includes_trace(&self) -> bool
Returns true if this level includes trace logs.
§Examples
use sublime_cli_tools::cli::LogLevel;
assert!(LogLevel::Trace.includes_trace());
assert!(!LogLevel::Debug.includes_trace());Trait Implementations§
Source§impl Ord for LogLevel
impl Ord for LogLevel
Source§impl PartialOrd for LogLevel
impl PartialOrd for LogLevel
impl Copy for LogLevel
impl Eq for LogLevel
impl StructuralPartialEq for LogLevel
Auto Trait Implementations§
impl Freeze for LogLevel
impl RefUnwindSafe for LogLevel
impl Send for LogLevel
impl Sync for LogLevel
impl Unpin for LogLevel
impl UnwindSafe for LogLevel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.