viva_telemetry/log/level

Log levels following syslog severity levels (RFC 5424)

From most severe to least: Emergency > Alert > Critical > Err > Warning > Notice > Info > Debug > Trace

Types

Log severity levels (RFC 5424 + Trace) Note: “Error” renamed to “Err” to avoid conflict with Result.Error

pub type Level {
  Emergency
  Alert
  Critical
  Err
  Warning
  Notice
  Info
  Debug
  Trace
}

Constructors

  • Emergency

    System is unusable

  • Alert

    Action must be taken immediately

  • Critical

    Critical conditions

  • Err

    Error conditions

  • Warning

    Warning conditions

  • Notice

    Normal but significant condition

  • Info

    Informational messages

  • Debug

    Debug-level messages

  • Trace

    Fine-grained tracing

Values

pub fn color_reset() -> String

ANSI reset code

pub fn compare(a: Level, b: Level) -> order.Order

Compare two levels (for filtering)

pub fn from_int(n: Int) -> Level

Parse level from integer

pub fn from_string(s: String) -> Result(Level, Nil)

Parse level from string (case insensitive)

pub fn is_enabled(log_level: Level, min_level: Level) -> Bool

Check if level a is at least as severe as level b

pub fn to_color(level: Level) -> String

ANSI color code for level

pub fn to_int(level: Level) -> Int

Convert level to numeric severity (lower = more severe)

pub fn to_short_string(level: Level) -> String

Convert level to short string (3 chars)

pub fn to_string(level: Level) -> String

Convert level to string

Search Document