CX · Reference guidelog
PlaygroundDownloadsAboutv0.18.0-pre.1

log

Structured logging: leveled emit with arbitrary structured fields. Configurable sinks support single or multi-sink fan-out with optional async, rotation, and sampling. Dynamic contextual scopes attach fields automatically to every log call within their extent via the [?with-scope] directive. Each event is a record of level, message, timestamp, and a fields map.

log:debug

[$log:debug] -> null — Emit a log event at the :debug level (verbose internals, disabled by default).

      [?lib 'cx-stdlib/log']
[$log:debug "verbose internals"]
    
      null
    

log:info

[$log:info] -> null — Emit a log event at the :info level for normal operational milestones.

      [?lib 'cx-stdlib/log']
[$log:info "operational milestone"]
    
      null
    

log:warn

[$log:warn] -> null — Emit a log event at the :warn level for recoverable problems.

      [?lib 'cx-stdlib/log']
[$log:warn "recoverable problem"]
    
      null
    

log:error

[$log:error] -> null — Emit a log event at the :error level for failed operations.

      [?lib 'cx-stdlib/log']
[$log:error "failed operation"]
    
      null
    

log:fatal

[$log:fatal] -> null — Emit a log event at the :fatal level; does not terminate the process (that is the application's job).

      [?lib 'cx-stdlib/log']
[$log:fatal "unrecoverable"]
    
      null
    

log:log

[$log:log] -> null — Emit a log event at a level chosen programmatically from a level atom.

      [?lib 'cx-stdlib/log']
[$log:log :info "programmatic level"]
    
      null
    

log:current-scope

[$log:current-scope] -> map — Return the merged active scope context as a map (empty when no scope is active).

      [?lib 'cx-stdlib/log']
[$log:current-scope]
    
      {}
    

log:configure

[$log:configure] -> null — Set the process-global logging config: minimum level, sinks, format, rotation, async, and sampling.

      [?lib 'cx-stdlib/log']
[$log:configure {level: :warn}]
    
      null
    

log:emit-raw

[$log:emit-raw] -> null — Emit a pre-shaped record directly to the sink, bypassing formatting.

      [?lib 'cx-stdlib/log']
[$log:emit-raw [log-event level=:info message="pre-shaped"]]
    
      null
    

log:is-enabled

[$log:is-enabled] -> bool — Report whether a level would produce output at some sink — a guard for expensive field construction.

      [?lib 'cx-stdlib/log']
[$log:is-enabled :debug]
    
      false