Logger

Config & IO

Leveled print-debugging. Debug.inspect is unchanged and always prints.

A call below the active floor returns its value and prints nothing. The floor is the process level from configure, else SELM_LOG_LEVEL (debug, info, warn, or error), else info when SELM_ENV=prod, else debug.

Types

Level

type Level
= Debug
| Info
| Warn
| Error

Severity, lowest to highest.

Examples

Logger.Info

Values

debug

debug : String -> a -> a

Log a tagged value at debug level, then return the value.

Examples

Logger.debug "user" user

info

info : String -> a -> a

Log a tagged value at info level, then return the value.

Examples

Logger.info "request" req.path

warn

warn : String -> a -> a

Log a tagged value at warn level, then return the value.

Examples

Logger.warn "retry" attempt

error

error : String -> a -> a

Log a tagged value at error level, then return the value.

Examples

Logger.error "fail" err

log

log : Level -> String -> a -> a

Log a tagged value at the given level, then return the value.

Examples

Logger.log Logger.Info "ready" model

configure

configure : Level -> ()

Set the minimum level for the current process.

Examples

Logger.configure Logger.Warn

metadata

metadata : List (String, String) -> ()

Replace the key/value pairs printed after each line in the current process.

Examples

Logger.metadata [ ("request_id", id) ]