Unified structured logging for replikativ projects using trove facade.
All log calls require a namespaced keyword ID for structured filtering.
Provides level macros (trace, debug, info, warn, error), a raise macro for logging + throwing, and timing utilities.
Usage: (require '[replikativ.logging :as log])
;; message only (for backwards compatibility) (log/info "Using config")
;; ID + message (log/info :datahike/connector "Using config")
;; ID + message + data (log/info :datahike/connector "Using config" {:config c})
;; ID + data only (log/info :datahike/connector {:config c})
;; Error logging + throw (log/raise "Invalid input" {:type :validation-error :input x})
;; Timing (log/with-timing :info :component/op "msg" (body))
Unified structured logging for replikativ projects using trove facade.
All log calls require a namespaced keyword ID for structured filtering.
Provides level macros (trace, debug, info, warn, error), a raise macro
for logging + throwing, and timing utilities.
Usage:
(require '[replikativ.logging :as log])
;; message only (for backwards compatibility)
(log/info "Using config")
;; ID + message
(log/info :datahike/connector "Using config")
;; ID + message + data
(log/info :datahike/connector "Using config" {:config c})
;; ID + data only
(log/info :datahike/connector {:config c})
;; Error logging + throw
(log/raise "Invalid input" {:type :validation-error :input x})
;; Timing
(log/with-timing :info :component/op "msg" (body))(debug msg)(debug id msg-or-data)(debug id msg data)(debug-timing id msg & body)Execute body and log duration at DEBUG level.
Execute body and log duration at DEBUG level.
(error msg)(error id msg-or-data)(error id msg data)(info msg)(info id msg-or-data)(info id msg data)(info-timing id msg & body)Execute body and log duration at INFO level.
Execute body and log duration at INFO level.
(raise & fragments)Logging an error and throwing an exception with message and structured data. Arguments:
Logging an error and throwing an exception with message and structured data. Arguments: - Any number of strings that describe the error - Last argument is a map of data that helps understanding the source of the error
(trace msg)(trace id msg-or-data)(trace id msg data)(warn msg)(warn id msg-or-data)(warn id msg data)(with-timing level id msg & body)Execute body and log duration at specified level. Returns the result of body.
Execute body and log duration at specified level. Returns the result of body.
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 |