March Docs

Bastion.Logger

lib/logger.march — Bastion.Logger

Thin wrapper over the March stdlib Logger.

The stdlib Logger handles level filtering, structured fields, and pluggable appenders. This module adds:

  1. Bastion's two-argument call convention: info(msg, meta)
   where meta : List((String, String)) maps naturally to logfmt/json fields.

2. A configure/2 helper called by the Application supervisor to
   wire up the appender and level from Config on startup.

3. _conn helpers that pull request_id from the Conn automatically.

The stdlib Logger is always available as Logger; use it directly for advanced use cases (with_scope, with_span, add_appender, etc.).

Functions

fnconfigureconfigure(level_str : String, format_str : String)#

Configure the stdlib Logger from application config. Call this once from Application.start() before any logging.

  Bastion.Logger.configure(Config.log_level(), Config.log_format())
fndebugdebug(msg : String, meta : List((String, String)))#

Log at DEBUG level with optional key-value metadata.

fnerrorerror(msg : String, meta : List((String, String)))#

Log at ERROR level with optional key-value metadata.

fnerror_connerror_conn(conn, msg : String, meta : List((String, String)))#
fninfoinfo(msg : String, meta : List((String, String)))#

Log at INFO level with optional key-value metadata.

fninfo_conninfo_conn(conn, msg : String, meta : List((String, String)))#
fnparse_levelparse_level(s : String)#

Parse a level string (case-insensitive). Defaults to Info on unknown input.

fnwarnwarn(msg : String, meta : List((String, String)))#

Log at WARN level with optional key-value metadata.

fnwarn_connwarn_conn(conn, msg : String, meta : List((String, String)))#