(->str val)
(current-context)
Returns the current context map, useful if you want to pass it to another process to continue logging with the same context. Note that due to how MDC works, this will only return the context map for the current thread and map keys will be strings, not keywords.
Returns the current context map, useful if you want to pass it to another process to continue logging with the same context. Note that due to how MDC works, this will only return the context map for the current thread and map keys will be strings, not keywords.
(debug msg)
(debug ctx msg)
Debug log, pass message or ctx+message
Debug log, pass message or ctx+message
(debugf & args)
(error msg)
(error exc msg)
(error ctx exc msg)
Log an error message. [msg] [exc msg] [ctx exc msg] Context map can only be provided when passing exception AND message, otherwise, wrap your call in with-context
Log an error message. [msg] [exc msg] [ctx exc msg] Context map can only be provided when passing exception AND message, otherwise, wrap your call in with-context
(errorf & args)
(format-context ctx)
(info msg)
(info ctx msg)
Log an info pass message or ctx+messag
Log an info pass message or ctx+messag
(infof & args)
(mdc-put ctx)
(timer)
When invoked captures current timestamp in ms, and returns a function that when invoked returns the time in ms since the original invocation.
This is useful if you want to instrument a function and return the time it took to run it and inject that into the MDC yourself.
Example:
(log/with-context {:operation "do-something"}
(let [get-run-time-ms (log/timer)
result (do-something)]
(log/info {:run-time-ms (get-run-time-ms)} "do-something completed")
result))
When invoked captures current timestamp in ms, and returns a function that when invoked returns the time in ms since the original invocation. This is useful if you want to instrument a function and return the time it took to run it and inject that into the MDC yourself. Example: ```clojure (log/with-context {:operation "do-something"} (let [get-run-time-ms (log/timer) result (do-something)] (log/info {:run-time-ms (get-run-time-ms)} "do-something completed") result)) ```
(warn msg)
(warn ctx msg)
Log a warning pass message or ctx+message
Log a warning pass message or ctx+message
(warnf & args)
(with-context ctx & body)
Set context map for the form. The context map should use unqualified keywords or strings for keys. Values will be stringified.
Set context map for the form. The context map should use unqualified keywords or strings for keys. Values will be stringified.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close