Liking cljdoc? Tell your friends :D

fx.observability.log

Zero-dependency contextual and structured logging for fx effect pipelines.

Zero-dependency contextual and structured logging for fx effect pipelines.
raw docstring

*default-logger-sink*clj/s


annotate-logs>clj/s

(annotate-logs> annotations)
(annotate-logs> prev-effect annotations)

Injects structured metadata key-values into :fx.observability/log-annotations in the execution context. All subsequent effects and log calls in the downstream pipeline will automatically inherit these annotations.

Example: (-> (fx.observability.log/annotate-logs> {:request-id "req-123" :user-id 42}) (fx/mapcat> (fn [_] (fx.observability.log/log-info> "User logged in"))))

Injects structured metadata key-values into `:fx.observability/log-annotations` in the execution context.
All subsequent effects and log calls in the downstream pipeline will automatically inherit
these annotations.

Example:
  (-> (fx.observability.log/annotate-logs> {:request-id "req-123" :user-id 42})
      (fx/mapcat> (fn [_] (fx.observability.log/log-info> "User logged in"))))
raw docstring

console-logger-sinkclj/s

(console-logger-sink entry)

Default console sink that formats and prints log entries to out (or err for :error).

Default console sink that formats and prints log entries to *out* (or *err* for :error).
raw docstring

level-prioritiesclj/s


log-annotations-layer>clj/s

(log-annotations-layer> annotations)

Creates a Layer providing :fx.observability/log-annotations.

Creates a Layer providing `:fx.observability/log-annotations`.
raw docstring

log-debug>clj/s

(log-debug> message)
(log-debug> a b)
(log-debug> prev-effect message log-data)

Creates a debug-level log effect.

Examples: (fx.observability.log/log-debug> "Cache hit" {:key "users:42"}) (-> (fetch-user 42) (fx.observability.log/log-debug> "Fetched user"))

Creates a debug-level log effect.

Examples:
  (fx.observability.log/log-debug> "Cache hit" {:key "users:42"})
  (-> (fetch-user 42)
      (fx.observability.log/log-debug> "Fetched user"))
raw docstring

log-error>clj/s

(log-error> message)
(log-error> a b)
(log-error> prev-effect message log-data)

Creates an error-level log effect.

Examples: (fx.observability.log/log-error> "Database connection failed" {:error (ex-message e)}) (-> (handle-failure err) (fx.observability.log/log-error> "Handled failure"))

Creates an error-level log effect.

Examples:
  (fx.observability.log/log-error> "Database connection failed" {:error (ex-message e)})
  (-> (handle-failure err)
      (fx.observability.log/log-error> "Handled failure"))
raw docstring

log-info>clj/s

(log-info> message)
(log-info> a b)
(log-info> prev-effect message log-data)

Creates an info-level log effect.

Examples: (fx.observability.log/log-info> "Server started" {:port 8080}) (-> (process-order order) (fx.observability.log/log-info> "Order processed"))

Creates an info-level log effect.

Examples:
  (fx.observability.log/log-info> "Server started" {:port 8080})
  (-> (process-order order)
      (fx.observability.log/log-info> "Order processed"))
raw docstring

log-level-layer>clj/s

(log-level-layer> level)

Creates a Layer providing :fx.observability/log-level.

Creates a Layer providing `:fx.observability/log-level`.
raw docstring

log-warn>clj/s

(log-warn> message)
(log-warn> a b)
(log-warn> prev-effect message log-data)

Creates a warn-level log effect.

Examples: (fx.observability.log/log-warn> "Rate limit threshold exceeded" {:current 95 :max 100}) (-> (retry-operation op) (fx.observability.log/log-warn> "Retrying operation"))

Creates a warn-level log effect.

Examples:
  (fx.observability.log/log-warn> "Rate limit threshold exceeded" {:current 95 :max 100})
  (-> (retry-operation op)
      (fx.observability.log/log-warn> "Retrying operation"))
raw docstring

log>clj/s

(log> level message)
(log> level-or-prev message-or-level data-or-message)
(log> prev-effect level message log-data)

Creates a structured log effect with the specified level, message, and optional log-data map. When chained in an effect pipeline, preserves and propagates the upstream value.

Creates a structured log effect with the specified `level`, `message`, and optional `log-data` map.
When chained in an effect pipeline, preserves and propagates the upstream value.
raw docstring

logger-layer>clj/s

(logger-layer> sink-or-opts)
(logger-layer> sink level)
(logger-layer> sink level annotations)

Creates a Layer providing :fx.observability/logger (and optionally :fx.observability/log-level and :fx.observability/log-annotations). Accepts a logger sink function (e.g. console-logger-sink, system-logger-sink) or an options map {:logger sink-fn :level :info :annotations {...}}.

Creates a Layer providing `:fx.observability/logger` (and optionally `:fx.observability/log-level` and `:fx.observability/log-annotations`).
Accepts a logger sink function (e.g. `console-logger-sink`, `system-logger-sink`) or an options map
`{:logger sink-fn :level :info :annotations {...}}`.
raw docstring

system-logger-sinkclj/s

(system-logger-sink entry)

Java System.Logger sink (delegates to System.getLogger on JVM, console on JS).

Java System.Logger sink (delegates to System.getLogger on JVM, console on JS).
raw docstring

with-log-level>clj/s

(with-log-level> level-or-eff eff-or-level)
(with-log-level> prev-effect level target-eff)

Executes effect with a scoped minimum log level (:debug, :info, :warn, :error).

Example: (fx.observability.log/with-log-level> :warn (noisy-pipeline>))

Executes `effect` with a scoped minimum log level (:debug, :info, :warn, :error).

Example:
  (fx.observability.log/with-log-level> :warn (noisy-pipeline>))
raw docstring

with-logger>clj/s

(with-logger> logger-fn-or-eff eff-or-logger-fn)
(with-logger> prev-effect logger-fn target-eff)

Executes effect with a scoped custom log sink function (fn [log-entry] ...).

Example: (fx.observability.log/with-logger> custom-sink-fn (do-work>))

Executes `effect` with a scoped custom log sink function `(fn [log-entry] ...)`.

Example:
  (fx.observability.log/with-logger> custom-sink-fn (do-work>))
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