comet

Create a gleaming trail of application logs.

Types

pub type Attribute {
  String(key: String, value: String)
  Int(key: String, value: Int)
  Float(key: String, value: Float)
  Bool(key: String, value: Bool)
  Fn(fn() -> Attribute)
}

Constructors

  • String(key: String, value: String)
  • Int(key: String, value: Int)
  • Float(key: String, value: Float)
  • Bool(key: String, value: Bool)
  • Fn(fn() -> Attribute)
pub opaque type Context
pub type Entry {
  Entry(
    ctx: Context,
    level: Level,
    message: String,
    attributes: List(Attribute),
  )
}

Constructors

  • Entry(
      ctx: Context,
      level: Level,
      message: String,
      attributes: List(Attribute),
    )
pub type Formatter =
  fn(Level, String, List(Attribute)) -> String
pub type Level {
  Trace
  Debug
  Info
  Warn
  Error
  Panic
}

Constructors

  • Trace
  • Debug
  • Info
  • Warn
  • Error
  • Panic
pub type LevelLoggerSet {
  LevelLoggerSet(
    trace: LevelLogger,
    debug: LevelLogger,
    info: LevelLogger,
    warn: LevelLogger,
    error: LevelLogger,
  )
}

Constructors

  • LevelLoggerSet(
      trace: LevelLogger,
      debug: LevelLogger,
      info: LevelLogger,
      warn: LevelLogger,
      error: LevelLogger,
    )
pub type LevelTextFn =
  fn(Level) -> String
pub type Output =
  fn(String, Level) -> Nil

Functions

pub fn attributes(
  next: fn(Entry) -> Option(Entry),
  attributes: List(Attribute),
) -> fn(Entry) -> Option(Entry)
pub fn builder() -> fn(Entry) -> Option(Entry)
pub fn debug(
  log: fn(Level, String, List(Attribute)) -> Nil,
) -> fn(String, List(Attribute)) -> Nil
pub fn error(
  log: fn(Level, String, List(Attribute)) -> Nil,
) -> fn(String, List(Attribute)) -> Nil
pub fn formatter(
  next: fn(Entry) -> Option(Entry),
  formatter: fn(Level, String, List(Attribute)) -> String,
) -> fn(Entry) -> Option(Entry)
pub fn get_level_text(level: Level) -> String
pub fn info(
  log: fn(Level, String, List(Attribute)) -> Nil,
) -> fn(String, List(Attribute)) -> Nil
pub fn json_formatter(
  level: Level,
  msg: String,
  attributes: List(Attribute),
) -> String
pub fn level_priority(level: Level) -> Int
pub fn level_text(
  next: fn(Entry) -> Option(Entry),
  func: fn(Level) -> String,
) -> fn(Entry) -> Option(Entry)
pub fn levels(
  log: fn(Level, String, List(Attribute)) -> Nil,
) -> LevelLoggerSet
pub fn log_level(
  next: fn(Entry) -> Option(Entry),
  level: Level,
) -> fn(Entry) -> Option(Entry)
pub fn logger(
  next: fn(Entry) -> Option(Entry),
) -> fn(Level, String, List(Attribute)) -> Nil
pub fn output(
  next: fn(Entry) -> Option(Entry),
  output: fn(String, Level) -> Nil,
) -> fn(Entry) -> Option(Entry)
pub fn timestamp(
  next: fn(Entry) -> Option(Entry),
) -> fn(Entry) -> Option(Entry)
pub fn trace(
  log: fn(Level, String, List(Attribute)) -> Nil,
) -> fn(String, List(Attribute)) -> Nil
pub fn warn(
  log: fn(Level, String, List(Attribute)) -> Nil,
) -> fn(String, List(Attribute)) -> Nil
pub fn write_output(entry: String, level: Level) -> Nil
Search Document