Codesmith Logger is a simple wrapper on logback (slf4j) and net.logstash.logback.
To use the library, it is necessary to call the macro deflogger
before any logging
macro is called.
Codesmith Logger is a simple wrapper on logback (slf4j) and net.logstash.logback. To use the library, it is necessary to call the macro `deflogger` before any logging macro is called.
(box arg)
(coerce-string arg)
Coerce, at compile time, the argument to be a String.
Coerce, at compile time, the argument to be a String.
(compile-to-array & args)
A transformation function that is applied to the context before logging. By default, it is the identity (no transformation).
A transformation function that is applied to the context before logging. By default, it is the identity (no transformation).
(ctx-marker ctx)
(debug-c ctx)
(debug-c ctx msg)
(debug-c ctx msg & args)
Uses log-c
on debug level.
Uses `log-c` on debug level.
(debug-e e)
(debug-e e msg)
(debug-e e ctx msg)
Uses log-e
on debug level.
Uses `log-e` on debug level.
(debug-m msg & args)
(deflogger)
Creates a var named ⠇⠕⠶⠻
in the current namespace *ns*
to contain a [[org.slf4j.Logger]]
The name is "logger" written in braille-2 notation.
Creates a var named `⠇⠕⠶⠻` in the current namespace `*ns*` to contain a [[org.slf4j.Logger]] The name is "logger" written in braille-2 notation.
(ensure-throwable e)
(error-c ctx)
(error-c ctx msg)
(error-c ctx msg & args)
Uses log-c
on error level.
Uses `log-c` on error level.
(error-e e)
(error-e e msg)
(error-e e ctx msg)
Uses log-e
on error level.
Uses `log-e` on error level.
(error-m msg & args)
(info-c ctx)
(info-c ctx msg)
(info-c ctx msg & args)
Uses log-c
on info level.
Uses `log-c` on info level.
(info-e e)
(info-e e msg)
(info-e e ctx msg)
Uses log-e
on info level.
Uses `log-e` on info level.
(info-m msg & args)
(level-pred method)
(log-c method ctx)
(log-c method ctx msg)
(log-c method ctx msg & args)
Logging macro to output the context map ctx
in the JSON string generated by the logstash encoder.
Variants allow to pass a message as slf4j format string with n arguments.
The argument method
is the symbol of the log method to call on the [[Logger]] object. Typically,
the level macros (trace-c
, debug-c
, etc.) are used instead of this macro.
The macro generates code that verifies that the corresponding log level is enabled.
Logging macro to output the context map `ctx` in the JSON string generated by the logstash encoder. Variants allow to pass a message as slf4j format string with n arguments. The argument `method` is the symbol of the log method to call on the [[Logger]] object. Typically, the level macros (`trace-c`, `debug-c`, etc.) are used instead of this macro. The macro generates code that verifies that the corresponding log level is enabled.
(log-e method e)
(log-e method e msg)
(log-e method e ctx msg)
Logging macro for logging a [[Throwable]] using the dedicated logging methods for errors.
Variants allow to pass an explicit message msg
and an explicit context ctx
. If no msg
is
provided, the message of the [[Throwable]] is use instead. If no context is provided, we use
ex-data
to obtain a context. If a context is provided, it is merged with ex-data
.
The argument method
is the symbol of the log method to call on the [[Logger]] object. Typically,
the level macros (trace-e
, debug-e
, etc.) are used instead of this macro.
The macro generates code that verifies that the corresponding log level is enabled.
Logging macro for logging a [[Throwable]] using the dedicated logging methods for errors. Variants allow to pass an explicit message `msg` and an explicit context `ctx`. If no `msg` is provided, the message of the [[Throwable]] is use instead. If no context is provided, we use `ex-data` to obtain a context. If a context is provided, it is merged with `ex-data`. The argument `method` is the symbol of the log method to call on the [[Logger]] object. Typically, the level macros (`trace-e`, `debug-e`, etc.) are used instead of this macro. The macro generates code that verifies that the corresponding log level is enabled.
(log-m method msg & args)
(set-context-logging-key! logging-key)
Configuration function to set the context-logging-key
.
Configuration function to set the [[context-logging-key]].
(set-context-pre-logging-transformation! tranformation)
Configuration function to set the context-pre-logging-transformation
Configuration function to set the [[context-pre-logging-transformation]]
(spy expr)
(spy level expr)
A spy macro to log inspection of an expression.
It will log the value of the expression and the expression itself as context via log-c
with "spy" as message.
By default, it uses the debug level; the diadic version allows to specify the level as string,
keyword or symbol (e.g. `(spy :info (+ 1 2)) for info level.
A spy macro to log inspection of an expression. It will log the value of the expression and the expression itself as context via `log-c` with "spy" as message. By default, it uses the debug level; the diadic version allows to specify the level as string, keyword or symbol (e.g. `(spy :info (+ 1 2)) for info level.
(throw-logger-missing-exception)
(trace-c ctx)
(trace-c ctx msg)
(trace-c ctx msg & args)
Uses loc-c
on trace level.
Uses `loc-c` on trace level.
(trace-e e)
(trace-e e msg)
(trace-e e ctx msg)
Uses log-e
on trace level.
Uses `log-e` on trace level.
(trace-m msg & args)
(warn-c ctx)
(warn-c ctx msg)
(warn-c ctx msg & args)
Uses log-c
on warn level.
Uses `log-c` on warn level.
(warn-e e)
(warn-e e msg)
(warn-e e ctx msg)
Uses log-e
on warn level.
Uses `log-e` on warn level.
(warn-m msg & args)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close