Liking cljdoc? Tell your friends :D

c3kit.apron.log

Hand-rolled cross-platform logging (no Timbre/SLF4J).

Level macros: trace, debug, info, warn, error, fatal, report. Level controls: off!, fatal!, error!, warn!, info!, debug!, all!, level, set-level!, with-level.

Test helpers: capture-logs (macro), parse-captured-logs, captured-logs-str. Raw @captured-logs holds maps {:level :message} — not a stable public layout; prefer the parse helpers in tests.

Levels (ascending severity): :trace < :debug < :info < :warn < :error < :fatal < :report. A call is emitted when its level is ≥ the configured minimum (default :info). When a call is suppressed, its arguments are not evaluated (macros wrap args in when).

Implementation dynamics (*min-level-override*, *capturing?*) and -emit! are not part of the supported API — use the macros and level helpers.

Hand-rolled cross-platform logging (no Timbre/SLF4J).

Level macros: `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `report`.
Level controls: `off!`, `fatal!`, `error!`, `warn!`, `info!`, `debug!`, `all!`,
`level`, `set-level!`, `with-level`.

Test helpers: `capture-logs` (macro), `parse-captured-logs`, `captured-logs-str`.
Raw `@captured-logs` holds maps `{:level :message}` — not a stable public layout;
prefer the parse helpers in tests.

Levels (ascending severity): :trace < :debug < :info < :warn < :error < :fatal < :report.
A call is emitted when its level is ≥ the configured minimum (default :info).
When a call is suppressed, its arguments are not evaluated (macros wrap args in `when`).

Implementation dynamics (`*min-level-override*`, `*capturing?*`) and `-emit!` are not part of
the supported API — use the macros and level helpers.
raw docstring

*capturing?*clj/s


*min-level-override*clj/s


-emit!clj/s

(-emit! lvl args)

Internal emit path. Prefer level macros. Defensive may-log? check; macros are responsible for not evaluating args when suppressed.

Internal emit path. Prefer level macros.
Defensive may-log? check; macros are responsible for not evaluating args when suppressed.
raw docstring

-nanosclj/s

(-nanos)

-platform-timeclj/s

(-platform-time)

all!clj/s

(all!)

capture-logsclj/smacro

(capture-logs & body)

Clear capture buffer, force min-level :trace for body, capture without printing. Restores previous global min-level afterward (not a dynamic with-level override).

Clear capture buffer, force min-level :trace for body, capture without printing.
Restores previous *global* min-level afterward (not a dynamic with-level override).
raw docstring

capture-logs*clj/s

(capture-logs* f)

Runtime implementation of capture-logs. Restores the global atom min-level (not the effective level), so nesting under with-level does not pollute the atom.

Runtime implementation of capture-logs. Restores the global atom min-level
(not the effective level), so nesting under with-level does not pollute the atom.
raw docstring

captured-logsclj/s

Atom buffer of captured log maps. Prefer parse-captured-logs / captured-logs-str.

Atom buffer of captured log maps. Prefer parse-captured-logs / captured-logs-str.
raw docstring

captured-logs-strclj/s

(captured-logs-str)

Newline-joined message strings from the capture buffer.

Newline-joined message strings from the capture buffer.
raw docstring

color-prclj/s

(color-pr message color)
For ANSI color codes: https://en.wikipedia.org/wiki/ANSI_escape_code
raw docstring

debugclj/smacro

(debug & args)

debug!clj/s

(debug!)

errorclj/smacro

(error & args)

error!clj/s

(error!)

fatalclj/smacro

(fatal & args)

fatal!clj/s

(fatal!)

infoclj/smacro

(info & args)

info!clj/s

(info!)

levelclj/s

(level)

Current effective minimum log level (dynamic override wins over global atom).

Current effective minimum log level (dynamic override wins over global atom).
raw docstring

may-log?clj/s

(may-log? lvl)

true when a call at lvl should be emitted under the current min-level. Safe for callers to use when guarding expensive work outside log macros.

true when a call at lvl should be emitted under the current min-level.
Safe for callers to use when guarding expensive work outside log macros.
raw docstring

off!clj/s

(off!)

parse-captured-logsclj/s

(parse-captured-logs)

Return captured entries as ({:level … :message …} …).

Return captured entries as ({:level … :message …} …).
raw docstring

reportclj/smacro

(report & args)

set-level!clj/s

(set-level! new-level)

Set global min-level. When the effective level changes, report "Setting log level: …". Note: under with-level, the dynamic override still wins until the binding exits; bang helpers update the global atom, which takes effect after with-level.

Set global min-level. When the *effective* level changes, report "Setting log level: …".
Note: under `with-level`, the dynamic override still wins until the binding exits;
bang helpers update the global atom, which takes effect after `with-level`.
raw docstring

table-specclj/s

(table-spec & cols)

test-levelsclj/s

(test-levels msg)

timeclj/smacro

(time expr)

Same as clojure.core/time but logs (info) instead of printing elapsed time.

Same as clojure.core/time but logs (info) instead of printing elapsed time.
raw docstring

traceclj/smacro

(trace & args)

warnclj/smacro

(warn & args)

warn!clj/s

(warn!)

with-levelclj/smacro

(with-level level & body)

Run body with a temporary min-level override (dynamic).

Run body with a temporary min-level override (dynamic).
raw 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