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
The instance of StatefulLog used by with-log. By default unbound.
The instance of StatefulLog used by with-log. By default unbound.
(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!
(logged? logger-ns level message)
(logged? logger-ns level throwable message)
Returns true if the log contains matching 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 true if the log contains matching 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).
(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.
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
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
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
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
(matches logger-ns level message)
(matches logger-ns level throwable message)
Returns matching log entries, otherwise nil.
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. Must be invoked within a context where *stateful-log* is bound to an instance of StatefulLog containing MatchableLogEntry items (e.g., inside with-log).
(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.
(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-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).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close