Liking cljdoc? Tell your friends :D

com.blockether.spel.logging

The one logging system for spel.

Every spel process — the CLI client, the background daemon, the browser engine helpers — writes through this namespace, so all diagnostics land in ONE place with ONE format instead of scattered println calls that vanish into a redirected stdout.

Layout:

  • One log file per session: <tmpdir>/spel-<session>.log (also the file the daemon subprocess appends its raw stdout/stderr to).
  • One line format: <iso-ts> <LEVEL> [<component>] <message>.
  • One level threshold: SPEL_LOG_LEVEL (debug|info|warn|error|off), or SPEL_DEBUG=true for debug. Default: info.

Read it back with spel logs (see read-lines, tail!).

The one logging system for spel.

Every spel process — the CLI client, the background daemon, the browser
engine helpers — writes through this namespace, so all diagnostics land in
ONE place with ONE format instead of scattered `println` calls that vanish
into a redirected stdout.

Layout:
- One log file per session: `<tmpdir>/spel-<session>.log` (also the file the
  daemon subprocess appends its raw stdout/stderr to).
- One line format: `<iso-ts> <LEVEL> [<component>] <message>`.
- One level threshold: `SPEL_LOG_LEVEL` (debug|info|warn|error|off), or
  `SPEL_DEBUG=true` for debug. Default: info.

Read it back with `spel logs` (see `read-lines`, `tail!`).
raw docstring

clear!clj

(clear! session)

Truncates a session's log file. Returns true when a file was cleared.

Truncates a session's log file. Returns true when a file was cleared.
sourceraw docstring

current-levelclj

(current-level)

Returns the active threshold keyword.

Returns the active threshold keyword.
sourceraw docstring

debug!clj

(debug! & parts)

Logs a debug line. Parts are str-joined.

Logs a debug line. Parts are `str`-joined.
sourceraw docstring

enabled?clj

(enabled? level)

True when level passes the active threshold.

True when `level` passes the active threshold.
sourceraw docstring

error!clj

(error! & parts)

Logs an error line. Parts are str-joined.

Logs an error line. Parts are `str`-joined.
sourceraw docstring

exception!clj

(exception! context e)

Logs an exception with a context label at warn level. Used in cleanup paths where we continue despite errors but never swallow them silently.

Logs an exception with a context label at warn level. Used in cleanup paths
where we continue despite errors but never swallow them silently.
sourceraw docstring

format-lineclj

(format-line ts level component message)

Builds one canonical log line: <ts> <LEVEL> [<component>] <message>. Pure — the single place the wire format is defined.

Builds one canonical log line: `<ts> <LEVEL> [<component>] <message>`.
Pure — the single place the wire format is defined.
sourceraw docstring

info!clj

(info! & parts)

Logs an info line. Parts are str-joined.

Logs an info line. Parts are `str`-joined.
sourceraw docstring

init!clj

(init! {:keys [session component level mirror file?]})

Configures the logger for this process. Call once at startup.

Params: opts - Map: :session - String session name (default "default") :component - String tag shown in every line, e.g. "cli" or "daemon" :level - Keyword/String threshold; defaults to SPEL_LOG_LEVEL/SPEL_DEBUG :mirror - Keyword/String level mirrored to stderr, or :off to never mirror (the daemon uses :off — its stderr already appends to the same log file, so mirroring would double every line) :file? - Boolean, write to the session log file (default true)

Configures the logger for this process. Call once at startup.

Params:
`opts` - Map:
  :session   - String session name (default "default")
  :component - String tag shown in every line, e.g. "cli" or "daemon"
  :level     - Keyword/String threshold; defaults to SPEL_LOG_LEVEL/SPEL_DEBUG
  :mirror    - Keyword/String level mirrored to stderr, or :off to never
               mirror (the daemon uses :off — its stderr already appends to
               the same log file, so mirroring would double every line)
  :file?     - Boolean, write to the session log file (default true)
sourceraw docstring

log!clj

(log! level message)

Logs message at level through the one sink. No-op below threshold.

Logs `message` at `level` through the one sink. No-op below threshold.
sourceraw docstring

log-exists?clj

(log-exists? session)

True when the session has a log file on disk.

True when the session has a log file on disk.
sourceraw docstring

log-file-pathclj

(log-file-path session)

Returns the log file path for a session — spel's single log sink.

Returns the log file path for a session — spel's single log sink.
sourceraw docstring

parse-levelclj

(parse-level x default-level)

Parses a level name (string or keyword) into a level keyword. Returns default-level when the input is blank or unrecognized.

Parses a level name (string or keyword) into a level keyword.
Returns `default-level` when the input is blank or unrecognized.
sourceraw docstring

read-linesclj

(read-lines session {:keys [lines]})

Returns the last n lines of a session's log (all of them when n is nil). Returns an empty vector when there is no log file yet.

Returns the last `n` lines of a session's log (all of them when `n` is nil).
Returns an empty vector when there is no log file yet.
sourceraw docstring

tail!clj

(tail! session {:keys [lines poll-ms] :or {poll-ms 250}})

Prints a session's log and then follows it, printing appended lines as they arrive. Blocks until interrupted.

Params: session - String session name opts - Map: :lines (initial tail size), :poll-ms (default 250)

Prints a session's log and then follows it, printing appended lines as they
arrive. Blocks until interrupted.

Params:
`session` - String session name
`opts`    - Map: :lines (initial tail size), :poll-ms (default 250)
sourceraw docstring

timestampclj

(timestamp instant)

Formats an Instant as the log's fixed-width UTC timestamp.

Formats an Instant as the log's fixed-width UTC timestamp.
sourceraw docstring

warn!clj

(warn! & parts)

Logs a warning line. Parts are str-joined.

Logs a warning line. Parts are `str`-joined.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close