Liking cljdoc? Tell your friends :D

clojure.tools.logging

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.
raw docstring

*force*clj

Overrides the default rules for choosing between logging directly or via an agent. Defaults to nil. See log* for details.

Overrides the default rules for choosing between logging directly or via an
agent. Defaults to nil. See log* for details.
sourceraw docstring

*logger-factory*clj

An instance satisfying the clojure.tools.logging.impl/LoggerFactory protocol, which allows uniform access to an underlying logging implementation.

The default value will be obtained by invoking a no-arg function named by the "clojure.tools.logging.factory" system property, or if unset, by invoking clojure.tools.logging.impl/find-factory.

After loading, this var can be programmatically changed to a different LoggerFactory implementation via binding or alter-var-root.

See the various factory functions in clojure.tools.logger.impl.

An instance satisfying the clojure.tools.logging.impl/LoggerFactory protocol,
which allows uniform access to an underlying logging implementation.

The default value will be obtained by invoking a no-arg function named by the
"clojure.tools.logging.factory" system property, or if unset, by invoking
clojure.tools.logging.impl/find-factory.

After loading, this var can be programmatically changed to a different
LoggerFactory implementation via binding or alter-var-root.

See the various factory functions in clojure.tools.logger.impl.
sourceraw docstring

*logging-agent*clj

The default agent used for performing logging when direct logging is disabled. See log* for details.

The default agent used for performing logging when direct logging is
disabled. See log* for details.
sourceraw docstring

*tx-agent-levels*clj

The set of levels that will require using an agent when logging from within a running transaction. Defaults to #{:info :warn}. See log* for details.

The set of levels that will require using an agent when logging from within a
running transaction. Defaults to #{:info :warn}. See log* for details.
sourceraw docstring

debugcljmacro

(debug message & more)
(debug throwable message & more)

Debug level logging using print-style args. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Debug level logging using print-style args.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

debugfcljmacro

(debugf fmt & fmt-args)
(debugf throwable fmt & fmt-args)

Debug level logging using format. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Debug level logging using format.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

enabled?cljmacro

(enabled? level)
(enabled? level logger-ns)

Returns true if the specific logging level is enabled. Use of this macro should only be necessary if one needs to execute alternate code paths beyond whether the log should be written to.

Returns true if the specific logging level is enabled.  Use of this macro
should only be necessary if one needs to execute alternate code paths beyond
whether the log should be written to.
sourceraw docstring

errorcljmacro

(error message & more)
(error throwable message & more)

Error level logging using print-style args. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Error level logging using print-style args.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

errorfcljmacro

(errorf fmt & fmt-args)
(errorf throwable fmt & fmt-args)

Error level logging using format. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Error level logging using format.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

fatalcljmacro

(fatal message & more)
(fatal throwable message & more)

Fatal level logging using print-style args. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Fatal level logging using print-style args.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

fatalfcljmacro

(fatalf fmt & fmt-args)
(fatalf throwable fmt & fmt-args)

Fatal level logging using format. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Fatal level logging using format.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

infocljmacro

(info message & more)
(info throwable message & more)

Info level logging using print-style args. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Info level logging using print-style args.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

infofcljmacro

(infof fmt & fmt-args)
(infof throwable fmt & fmt-args)

Info level logging using format. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Info level logging using format.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

logcljmacro

(log level message)
(log level throwable message)
(log logger-ns level throwable message)
(log logger-factory logger-ns level throwable message)

Evaluates and logs a message only if the specified level is enabled. See log* for more details.

Evaluates and logs a message only if the specified level is enabled. See log*
for more details.
sourceraw docstring

log*clj

(log* logger level throwable message)

Attempts to log a message, either directly or via an agent; does not check if the level is enabled.

For performance reasons, an agent will only be used when invoked within a running transaction, and only for logging levels specified by tx-agent-levels. This allows those entries to only be written once the transaction commits, and are discarded if it is retried or aborted. As corollary, other levels (e.g., :debug, :error) will be written even from failed transactions though at the cost of repeat messages during retries.

One can override the above by setting force to :direct or :agent; all subsequent writes will be direct or via an agent, respectively.

Attempts to log a message, either directly or via an agent; does not check if
the level is enabled.

For performance reasons, an agent will only be used when invoked within a
running transaction, and only for logging levels specified by
*tx-agent-levels*. This allows those entries to only be written once the
transaction commits, and are discarded if it is retried or aborted.  As
corollary, other levels (e.g., :debug, :error) will be written even from
failed transactions though at the cost of repeat messages during retries.

One can override the above by setting *force* to :direct or :agent; all
subsequent writes will be direct or via an agent, respectively.
sourceraw docstring

log-capture!clj

(log-capture! logger-ns)
(log-capture! logger-ns out-level err-level)

Captures System.out and System.err, piping all writes of those streams to the log. If unspecified, levels default to :info and :error, respectively. The specified logger-ns value will be used to namespace all log entries.

Note: use with-logs to redirect output of out or err.

Warning: if the logging implementation is configured to output to System.out (as is the default with java.util.logging) then using this function will result in StackOverflowException when writing to the log.

Captures System.out and System.err, piping all writes of those streams to
the log. If unspecified, levels default to :info and :error, respectively.
The specified logger-ns value will be used to namespace all log entries.

Note: use with-logs to redirect output of *out* or *err*.

Warning: if the logging implementation is configured to output to System.out
(as is the default with java.util.logging) then using this function will
result in StackOverflowException when writing to the log.
sourceraw docstring

log-streamclj

(log-stream level logger-ns)

Creates a PrintStream that will output to the log at the specified level.

Creates a PrintStream that will output to the log at the specified level.
sourceraw docstring

log-uncapture!clj

(log-uncapture!)

Restores System.out and System.err to their original values.

Restores System.out and System.err to their original values.
sourceraw docstring

logfcljmacro

(logf level fmt & fmt-args)
(logf level throwable fmt & fmt-args)

Logs a message using a format string and args. Can optionally take a throwable as its second arg. See level-specific macros, e.g., debugf. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Logs a message using a format string and args. Can optionally take a
throwable as its second arg. See level-specific macros, e.g., debugf.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

logpcljmacro

(logp level message & more)
(logp level throwable message & more)

Logs a message using print style args. Can optionally take a throwable as its second arg. See level-specific macros, e.g., debug. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Logs a message using print style args. Can optionally take a throwable as its
second arg. See level-specific macros, e.g., debug.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

spycljmacro

(spy expr)
(spy level expr)

Evaluates expr and may write the form and its result to the log. Returns the result of expr. Defaults to :debug log level.

Evaluates expr and may write the form and its result to the log. Returns the
result of expr. Defaults to :debug log level.
sourceraw docstring

spyfcljmacro

(spyf fmt expr)
(spyf level fmt expr)

Evaluates expr and may write (format fmt result) to the log. Returns the result of expr. Defaults to :debug log level. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Evaluates expr and may write (format fmt result) to the log. Returns the
result of expr. Defaults to :debug log level.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

tracecljmacro

(trace message & more)
(trace throwable message & more)

Trace level logging using print-style args. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Trace level logging using print-style args.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

tracefcljmacro

(tracef fmt & fmt-args)
(tracef throwable fmt & fmt-args)

Trace level logging using format. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Trace level logging using format.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

warncljmacro

(warn message & more)
(warn throwable message & more)

Warn level logging using print-style args. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Warn level logging using print-style args.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

warnfcljmacro

(warnf fmt & fmt-args)
(warnf throwable fmt & fmt-args)

Warn level logging using format. Use the 'logging.readable' namespace to avoid wrapping args in pr-str.

Warn level logging using format.
Use the 'logging.readable' namespace to avoid wrapping args in pr-str.
sourceraw docstring

with-logscljmacro

(with-logs logger-ns & body)
(with-logs [logger-ns out-level err-level] & body)

Evaluates exprs in a context in which out and err write to the log. The specified logger-ns value will be used to namespace all log entries.

By default out and err write to :info and :error, respectively.

Evaluates exprs in a context in which *out* and *err* write to the log. The
specified logger-ns value will be used to namespace all log entries.

By default *out* and *err* write to :info and :error, respectively.
sourceraw docstring

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

× close