Liking cljdoc? Tell your friends :D

clojure.tools.logging.test

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"))                             ; false
raw docstring

*stateful-log*clj

The instance of StatefulLog used by with-log. By default unbound.

The instance of StatefulLog used by with-log. By default unbound.
raw docstring

atomic-logclj

(atomic-log log-entry-fn)

Returns a StatefulLog, appending to an atom the result of invoking log-entry-fn with the same args as append!

Returns a StatefulLog, appending to an atom the result of invoking
log-entry-fn with the same args as append!
raw docstring

logged?clj

(logged? logger-ns level message)
(logged? logger-ns level throwable message)

Returns true if the log contains matching entries. See match-logger-ns?, match-level?, match-throwable?, and match-message? for the default matching behavior applied to the given args.

Must be invoked within a context where stateful-log is bound to an instance of StatefulLog containing MatchableLogEntry items (e.g., inside with-log).

Returns true if the log contains matching entries. See match-logger-ns?,
match-level?, match-throwable?, and match-message? for the default matching
behavior applied to the given args.

Must be invoked within a context where *stateful-log* is bound to an instance
of StatefulLog containing MatchableLogEntry items (e.g., inside with-log).
raw docstring

logger-factoryclj

(logger-factory stateful-log enabled-pred)

Returns a LoggerFactory that will append log entries to stateful-log. Levels are enabled when (enabled-pred logger-ns level) is true.

Returns a LoggerFactory that will append log entries to stateful-log. Levels
are enabled when (enabled-pred logger-ns level) is true.
raw docstring

match-level?cljmultimethod

Returns true if expected matches the actual level. Used by LogEntry/matches? implementation.

Dispatches on the types of expected and actual.

Provided methods' dispatch values and matching: :default if equal [Fn Object] if (f actual) is logically true [Set Object] if set contains actual

Returns true if expected matches the actual level. Used by
LogEntry/matches? implementation.

Dispatches on the types of expected and actual.

Provided methods' dispatch values and matching:
  :default      if equal
  [Fn Object]   if (f actual) is logically true
  [Set Object]  if set contains actual
raw docstring

match-logger-ns?cljmultimethod

Returns true if expected matches the actual namespace. Used by LogEntry/matches? implementation.

Dispatches on the types of expected and actual.

Provided methods' dispatch values and matching: :default if equal [Fn Object] if (f actual) is logically true [String Namespace] if string equals namespace's string [Symbol Namespace] if symbol equals namespace's symbol

Returns true if expected matches the actual namespace. Used by
LogEntry/matches? implementation.

Dispatches on the types of expected and actual.

Provided methods' dispatch values and matching:
  :default            if equal
  [Fn Object]         if (f actual) is logically true
  [String Namespace]  if string equals namespace's string
  [Symbol Namespace]  if symbol equals namespace's symbol
raw docstring

match-message?cljmultimethod

Returns true if expected matches the actual message. Used by LogEntry/matches? implementation.

Dispatches on the types of expected and actual.

Provided methods' dispatch values and matching: :default if equal [Fn Object] if (f actual) is logically true [Pattern String] if pattern matches actual

Returns true if expected matches the actual message. Used by
LogEntry/matches? implementation.

Dispatches on the types of expected and actual.

Provided methods' dispatch values and matching:
  :default          if equal
  [Fn Object]       if (f actual) is logically true
  [Pattern String]  if pattern matches actual
raw docstring

match-throwable?cljmultimethod

Returns true if expected matches the actual throwable. Used by LogEntry/matches? implementation.

Dispatches on the types of expected and actual. If expected is a vector, will instead use a vector of the contained types.

Provided methods' dispatch values and matching: :default if equal [Fn Object] if (f actual) is logically true [Class Object] if actual is an instance of Class [[Class String] Throwable] ... and if string equals exception message [[Class Pattern] Throwable] ... and if pattern matches exception message

Returns true if expected matches the actual throwable. Used by
LogEntry/matches? implementation.

Dispatches on the types of expected and actual. If expected is a vector, will
instead use a vector of the contained types.

Provided methods' dispatch values and matching:
  :default                     if equal
  [Fn Object]                  if (f actual) is logically true
  [Class Object]               if actual is an instance of Class
  [[Class String] Throwable]   ... and if string equals exception message
  [[Class Pattern] Throwable]  ... and if pattern matches exception message
raw docstring

MatchableLogEntrycljprotocol

matches?clj

(matches? this logger-ns level throwable message)

matchesclj

(matches logger-ns level message)
(matches logger-ns level throwable message)

Returns matching log entries, otherwise nil. See match-logger-ns?, match-level?, match-throwable?, and match-message? for the default matching behavior applied to the given args.

Must be invoked within a context where stateful-log is bound to an instance of StatefulLog containing MatchableLogEntry items (e.g., inside with-log).

Returns matching log entries, otherwise nil. See match-logger-ns?,
match-level?, match-throwable?, and match-message? for the default matching
behavior applied to the given args.

Must be invoked within a context where *stateful-log* is bound to an instance
of StatefulLog containing MatchableLogEntry items (e.g., inside with-log).
raw docstring

StatefulLogcljprotocol

append!clj

(append! this logger-ns level throwable message)

Returns this log with a new log entry appended.

Returns this log with a new log entry appended.

entriesclj

(entries this)

Returns a vector of the entries in this log, oldest first.

Returns a vector of the entries in this log, oldest first.

the-logclj

(the-log)

Returns the vector of current log entries.

Must be invoked within a context where stateful-log is bound to an instance of StatefulLog containing MatchableLogEntry items (e.g., inside with-log).

Returns the vector of current log entries.

Must be invoked within a context where *stateful-log* is bound to an instance
of StatefulLog containing MatchableLogEntry items (e.g., inside with-log).
raw docstring

with-logcljmacro

(with-log & body)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close