(flatten-ctx ctx)Returns a mulog context that re-parents a span directly under the turn's
root span, by pointing :mulog/parent-trace at the shared
:mulog/root-trace. Wrap a span in (with-context (flatten-ctx ctx) ...)
to render sibling steps as a flat list instead of each nesting under the
previous one. Returns ctx unchanged when it carries no root-trace.
Returns a mulog context that re-parents a span directly under the turn's root span, by pointing `:mulog/parent-trace` at the shared `:mulog/root-trace`. Wrap a span in `(with-context (flatten-ctx ctx) ...)` to render sibling steps as a flat list instead of each nesting under the previous one. Returns `ctx` unchanged when it carries no root-trace.
(local-context)Function wrapper for mulog/local-context. Returns the current mulog context map.
Function wrapper for mulog/local-context. Returns the current mulog context map.
(log-level)Returns the current global log level.
Returns the current global log level.
(safe-for-log v)Returns a single log-safe string representation of v, suitable as a tag value for Zipkin / OTel publishers without truncation surprises. Pipeline:
:db, :conn, :!conn,
:old-db, :db-after, :db-before, :db-snapshot, :tx-result);
truncate sequential / set collections > 3 elements with "...";
stringify keywords/dates/unknown ref types; record dropped keys
under :_dropped.pr-str the result (Clojure-EDN-encoded, JSON-embeddable as a
string value).…<truncated> suffix so individual
events never exceed downstream tag-value limits.Returns a single log-safe **string** representation of v, suitable as a tag value for Zipkin / OTel publishers without truncation surprises. Pipeline: 1. Recursively sanitize: drop heavy keys (`:db`, `:conn`, `:!conn`, `:old-db`, `:db-after`, `:db-before`, `:db-snapshot`, `:tx-result`); truncate sequential / set collections > 3 elements with `"..."`; stringify keywords/dates/unknown ref types; record dropped keys under `:_dropped`. 2. `pr-str` the result (Clojure-EDN-encoded, JSON-embeddable as a string value). 3. Hard-cap to ~8000 chars with a `…<truncated>` suffix so individual events never exceed downstream tag-value limits.
(set-log-level! level)Sets the global log level. Called once at startup from config. Levels (ascending): :verbose < :debug < :info < :warn.
Sets the global log level. Called once at startup from config. Levels (ascending): :verbose < :debug < :info < :warn.
(trace event-name pairs & body)Always runs (u/trace event-name pairs body). Same as (trace-when true event-name pairs body). Usage: (trace event-name [k1 v1 ...] body)
Always runs (u/trace event-name pairs body). Same as (trace-when true event-name pairs body). Usage: (trace event-name [k1 v1 ...] body)
(trace-enabled? level min-level)Returns true when trace at level should be emitted given min-level. Levels (ascending): :verbose < :debug < :info < :warn.
Returns true when trace at level should be emitted given min-level. Levels (ascending): :verbose < :debug < :info < :warn.
(trace-when condition event-name pairs & body)When condition is true, runs (u/trace event-name pairs body). Otherwise runs body only. The body is always executed; only the tracing is conditional. Usage: (trace-when condition event-name [k1 v1 ...] body) Example: (trace-when (trace-enabled? :debug min-level) "llm/event" [...] (do-something))
When condition is true, runs (u/trace event-name pairs body). Otherwise runs body only. The body is always executed; only the tracing is conditional. Usage: (trace-when condition event-name [k1 v1 ...] body) Example: (trace-when (trace-enabled? :debug min-level) "llm/event" [...] (do-something))
(warn event-name pairs)Emits a discrete mulog event at warn severity. Unlike trace, this is
a fire-and-forget event with no body — used for refusal/conflict
branches that don't wrap a computation. pairs is a flat bracket-vector
of k/v pairs (same shape as trace's pairs arg) for visual symmetry.
Usage: (warn event-name [k1 v1 k2 v2 ...])
Emits a discrete mulog event at warn severity. Unlike `trace`, this is a fire-and-forget event with no body — used for refusal/conflict branches that don't wrap a computation. `pairs` is a flat bracket-vector of k/v pairs (same shape as `trace`'s pairs arg) for visual symmetry. Usage: (warn event-name [k1 v1 k2 v2 ...])
(with-context ctx & body)Macro wrapper for mulog/with-context. Usage: (with-context ctx-map & body) Example: (with-context {:mulog/trace-id "123"} (trace ...))
Macro wrapper for mulog/with-context.
Usage: (with-context ctx-map & body)
Example: (with-context {:mulog/trace-id "123"} (trace ...))cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |