pub enum LogLevel {
ALL,
NONE,
DISABLED,
TRACE,
DEBUG,
VERBOSE,
INFO,
WARN,
ERROR,
FATAL,
CRITICAL,
}Expand description
An enumeration of the different levels that a log message can have, ordered by severity.
Variants§
ALL
ALL: The log level includes all levels.
NONE
NONE: No logging.
DISABLED
DISABLED: Logging is disabled.
TRACE
TRACE: Finer-grained informational events than DEBUG.
DEBUG
DEBUG: Debugging information, typically useful for developers.
VERBOSE
VERBOSE: Detailed logging, often more detailed than INFO.
INFO
INFO: Informational messages that highlight the progress of the application.
WARN
WARN: Potentially harmful situations.
ERROR
ERROR: Error events that might still allow the application to continue running.
FATAL
FATAL: Very severe error events that will presumably lead the application to abort.
CRITICAL
CRITICAL: Critical conditions, often requiring immediate attention.
Implementations§
Source§impl LogLevel
impl LogLevel
Sourcepub const fn to_numeric(self) -> u8
pub const fn to_numeric(self) -> u8
Converts the log level to its corresponding numeric value, similar to syslog severity levels.
§Examples
use rlg_core::LogLevel;
assert_eq!(LogLevel::ERROR.to_numeric(), 8);
assert_eq!(LogLevel::DEBUG.to_numeric(), 4);Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
Returns the uppercase string representation of the log level.
Sourcepub const fn as_str_lowercase(&self) -> &'static str
pub const fn as_str_lowercase(&self) -> &'static str
Returns the lowercase string representation of the log level.
Sourcepub const fn from_numeric(value: u8) -> Option<Self>
pub const fn from_numeric(value: u8) -> Option<Self>
Source§impl LogLevel
impl LogLevel
Sourcepub const fn includes(self, other: Self) -> bool
pub const fn includes(self, other: Self) -> bool
Checks if the current log level includes another log level.
§Arguments
other- The log level to compare with.
§Examples
use rlg_core::LogLevel;
assert!(LogLevel::ERROR.includes(LogLevel::DEBUG)); // ERROR includes DEBUG
assert!(!LogLevel::DEBUG.includes(LogLevel::WARN)); // DEBUG does not include WARN
assert!(LogLevel::WARN.includes(LogLevel::DEBUG)); // WARN includes DEBUG