pine

Types

Logger

opaque

The logger type. This is opaque by default to prevent developers from relying on implementation details that may change.

pub opaque type Logger

Functions

pub fn debug(logger: Logger, msg: String) -> Logger

Creates a debug log.

pub fn err(logger: Logger, msg: String) -> Logger

Creates an err log.

pub fn format_json() -> fn(Log) -> String

Creates a formatter that outputs to json.

pub fn format_plain() -> fn(Log) -> String

Creates a formatter that outputs to one line of plain text where each attribute is separated by a space.

pub fn info(logger: Logger, msg: String) -> Logger

Creates an info log.

pub fn level_debug() -> Level

The debug logging level.

pub fn level_err() -> Level

The err logging level.

pub fn level_info() -> Level

The info logging level.

pub fn level_warn() -> Level

The warn logging level.

pub fn new() -> Logger

Create a new Logger.

This uses the defaults of:

  • plain format
  • console transport
  • debug level
pub fn set_format(
  logger: Logger,
  new_format: fn(Log) -> String,
) -> Logger

Sets the logger to the given format.

pub fn set_level(logger: Logger, new_level: Level) -> Logger

Sets the logger to the given level.

pub fn set_transport(
  logger: Logger,
  new_transport: fn(String) -> Nil,
) -> Logger

Sets the logger to the given transport.

pub fn transport_console() -> fn(String) -> Nil

Creates a transport that writes to the console.

pub fn transport_file(filename: String) -> fn(String) -> Nil

Creates a transport that writes the given file.

pub fn warn(logger: Logger, msg: String) -> Logger

Creates a warn log.

pub fn with_bool(
  logger: Logger,
  key: String,
  value: Bool,
) -> Logger

Adds a new ‘bool’ attribute to a logger.

pub fn with_float(
  logger: Logger,
  key: String,
  value: Float,
) -> Logger

Adds a new ‘float’ attribute to a logger.

pub fn with_int(
  logger: Logger,
  key: String,
  value: Int,
) -> Logger

Adds a new ‘int’ attribute to a logger.

pub fn with_string(
  logger: Logger,
  key: String,
  value: String,
) -> Logger

Adds a new ‘string’ attribute to a logger.

Search Document