pub enum LogLevel {
Trace,
Debug,
Info,
Warn,
Error,
Fatal,
}Expand description
Logging severity levels in ascending order of importance.
The levels follow the common convention:
Trace: Very detailed information, typically only needed when debugging specific issuesDebug: Detailed information useful for debuggingInfo: General information about application progressWarn: Potentially harmful situations that might need attentionError: Error events that might still allow the application to continue running
Variants§
Trace
Very detailed information for debugging specific issues
Debug
Detailed information useful for debugging
Info
General information about application progress
Warn
Potentially harmful situations
Error
Error events, Could still allow the application to continue running
Fatal
Fatal error events that lead to application termination
Implementations§
Source§impl LogLevel
impl LogLevel
Sourcepub fn default_coloring(&self) -> String
pub fn default_coloring(&self) -> String
Returns the level string with appropriate color formatting.
Each log level has an associated color:
- Trace: Cyan
- Debug: Blue
- Info: Green
- Warn: Yellow
- Error: Red
§Returns
The formatted string with ANSI color codes applied
Examples found in repository?
More examples
Trait Implementations§
Source§impl FromStr for LogLevel
Parse the log level from &str.
impl FromStr for LogLevel
Parse the log level from &str.
Useful for things like clap to parse the log level via command-line arguments.
Source§impl Ord for LogLevel
impl Ord for LogLevel
Source§impl PartialOrd for LogLevel
impl PartialOrd for LogLevel
Source§impl ValueEnum for LogLevel
Implementation of the clap’s ValueEnum trait for LogLevel when the “clap” feature is enabled.
impl ValueEnum for LogLevel
Implementation of the clap’s ValueEnum trait for LogLevel when the “clap” feature is enabled.
This allows using LogLevel directly with clap’s derive API and provides several ways to specify log levels on the command line:
§Command-line examples:
myapp --log-level debug
myapp --log-level DEBUG
myapp --log-level DebugThis implementation provides the list of all possible log level variants and defines how they can be specified from command-line arguments, supporting case-insensitive matching.
Source§fn value_variants<'a>() -> &'a [Self]
fn value_variants<'a>() -> &'a [Self]
Returns an array slice containing all variants of LogLevel.
This is used by clap to validate and parse command-line arguments.
Source§fn to_possible_value(&self) -> Option<PossibleValue>
fn to_possible_value(&self) -> Option<PossibleValue>
Converts a LogLevel variant to its string representation with aliases.
For each log level, this provides:
- A lowercase default (e.g., “debug”)
- An uppercase alias (e.g., “DEBUG”)
- A title case alias (e.g., “Debug”)
This allows users to specify the log level in any case they prefer.