Logging macros which delegate to a specific logging implementation.
A logging implementation is selected at runtime when this namespace is first loaded. For more details, see the documentation for logger-factory.
If you want to test that your code emits specific log messages, see the clojure.tools.logging.test namespace.
Logging macros which delegate to a specific logging implementation. A logging implementation is selected at runtime when this namespace is first loaded. For more details, see the documentation for *logger-factory*. If you want to test that your code emits specific log messages, see the clojure.tools.logging.test namespace.
Protocols used to allow access to logging implementations. This namespace only need be used by those providing logging implementations to be consumed by the core api.
Protocols used to allow access to logging implementations. This namespace only need be used by those providing logging implementations to be consumed by the core api.
Logging macros that support printing message (some) arguments as if wrapped in pr-str, the goal being to preserve their data representation distinct from the explanatory text. See logp and logf for details regarding which args are treated in this manner.
Examples:
(require '[clojure.tools.logging :as log] '[clojure.tools.logging.readable :as logr])
(def x "bar") ; Logged as... (log/debug "foo" x "baz") ; foo bar baz (logr/debug "foo" x "baz") ; foo "bar" baz (log/debugf "foo %s %s" x "baz") ; foo bar baz (logr/debugf "foo %s %s" x "baz") ; foo "bar" "baz"
Logging macros that support printing message (some) arguments as
if wrapped in pr-str, the goal being to preserve their data representation
distinct from the explanatory text. See logp and logf for details regarding
which args are treated in this manner.
Examples:
(require '[clojure.tools.logging :as log]
'[clojure.tools.logging.readable :as logr])
(def x "bar")
; Logged as...
(log/debug "foo" x "baz") ; foo bar baz
(logr/debug "foo" x "baz") ; foo "bar" baz
(log/debugf "foo %s %s" x "baz") ; foo bar baz
(logr/debugf "foo %s %s" x "baz") ; foo "bar" "baz"
Support for testing whether logging calls are made.
Usage example: (require '[clojure.tools.logging :as log] '[clojure.tools.logging.test :refer [logged? with-log])
(with-log (log/info "Hello World!") (log/error (Exception. "Did a thing") "Error: oops") (logged? 'user :info #"Hello") ; true (logged? 'user :error [Throwable #"thing"] #"Error:") ; true (logged? 'user :debug "Hi")) ; false
Support for testing whether logging calls are made.
Usage example:
(require '[clojure.tools.logging :as log]
'[clojure.tools.logging.test :refer [logged? with-log])
(with-log
(log/info "Hello World!")
(log/error (Exception. "Did a thing") "Error: oops")
(logged? 'user :info #"Hello") ; true
(logged? 'user :error [Throwable #"thing"] #"Error:") ; true
(logged? 'user :debug "Hi")) ; falsecljdoc 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 |