birch/level
Log levels for controlling which messages are emitted.
Levels are ordered by severity: TRACE < DEBUG < INFO < WARN < ERROR < FATAL
Messages at or above the configured threshold are logged; those below are filtered.
Types
Log level representing the severity of a log message.
Levels are ordered from least to most severe:
Trace: Very detailed diagnostic informationDebug: Debugging information useful during developmentInfo: Normal operational messages (default threshold)Warn: Warning conditions that might need attentionErr: Error conditions that should be addressedFatal: Critical errors that prevent the system from continuing
Note: Err is used instead of Error to avoid conflict with the
Result type’s Error constructor.
pub type Level {
Trace
Debug
Info
Warn
Err
Fatal
}
Constructors
-
Trace -
Debug -
Info -
Warn -
Err -
Fatal
Values
pub fn compare(a: Level, b: Level) -> order.Order
Compare two log levels. Returns the ordering relationship between them.
pub fn from_string(s: String) -> Result(Level, Nil)
Parse a string into a log level. Case-insensitive. Returns Error for unrecognized strings.
pub fn gte(a: Level, b: Level) -> Bool
Check if the first level is at least as severe as the second.
Used for filtering: should_log(message_level, threshold).
pub fn to_int(level: Level) -> Int
Convert a log level to its integer representation. Lower numbers are less severe.
pub fn to_string(level: Level) -> String
Convert a log level to its string representation.
pub fn to_string_lowercase(level: Level) -> String
Convert a log level to a lowercase string (for JSON output).