Liking cljdoc? Tell your friends :D

taoensso.timbre

Simple, flexible logging for Clojure/Script. No XML.

Simple, flexible logging for Clojure/Script. No XML.
raw docstring

*config*cljs

See example-config for info.

See `example-config` for info.
sourceraw docstring

*context*cljs

General-purpose dynamic logging context

General-purpose dynamic logging context
sourceraw docstring

-levels-mapcljs

source

-levels-setcljs

source

-levels-veccljs

source

-log!cljs

(-log! config level ?ns-str ?file ?line msg-type ?err vargs_ ?base-data)
(-log! config
       level
       ?ns-str
       ?file
       ?line
       msg-type
       ?err
       vargs_
       ?base-data
       callsite-id)

Core low-level log fn. Implementation detail!

Core low-level log fn. Implementation detail!
sourceraw docstring

-log-and-rethrow-errorscljsmacro

(-log-and-rethrow-errors ?line & body)
source

-log-errorscljsmacro

(-log-errors ?line & body)
source

-logged-futurecljsmacro

(-logged-future ?line & body)
source

-spycljsmacro

(-spy ?line config level name expr)
source

console-?appendercljs

source

console-appendercljs

source

debugcljsmacro

(debug & args)
source

debugfcljsmacro

(debugf & args)
source

default-errcljs

source

default-outcljs

source

default-output-fncljs

(default-output-fn data)
(default-output-fn opts data)

Default (fn [data]) -> string output fn. Use(partial default-output-fn <opts-map>) to modify default opts.

Default (fn [data]) -> string output fn.
Use`(partial default-output-fn <opts-map>)` to modify default opts.
sourceraw docstring

errorcljsmacro

(error & args)
source

errorfcljsmacro

(errorf & args)
source

example-configcljs

Example (+default) Timbre v4 config map.

APPENDERS An appender is a map with keys: :min-level ; Level keyword, or nil (=> no minimum level) :enabled? ; :async? ; Dispatch using agent? Useful for slow appenders (clj only) :rate-limit ; [[ncalls-limit window-ms] <...>], or nil :output-fn ; Optional override for inherited (fn [data]) -> string :timestamp-opts ; Optional override for inherited {:pattern _ :locale _ :timezone _} (clj only) :ns-whitelist ; Optional, stacks with active config's whitelist :ns-blacklist ; Optional, stacks with active config's blacklist :fn ; (fn [data]) -> side effects, with keys described below

An appender's fn takes a single data map with keys: :config ; Entire config map (this map, etc.) :appender-id ; Id of appender currently dispatching :appender ; Entire map of appender currently dispatching :instant ; Platform date (java.util.Date or js/Date) :level ; Keyword :error-level? ; Is level e/o #{:error :fatal}? :?ns-str ; String, or nil :?file ; String, or nil :?line ; Integer, or nil ; Waiting on CLJ-865 :?err ; First-arg platform error, or nil :vargs ; Vector of raw args :output_ ; Forceable - final formatted output string created ; by calling (output-fn <this-data-map>) :msg_ ; Forceable - args as a string :timestamp_ ; Forceable - string (clj only) :hostname_ ; Forceable - string (clj only) :output-fn ; (fn [data]) -> formatted output string ; (see default-output-fn for details) :context ; context value at log time (see with-context)

**NB** - any keys not specifically documented here should be
considered private / subject to change without notice.

MIDDLEWARE Middleware are simple (fn [data]) -> ?data fns (applied left->right) that transform the data map dispatched to appender fns. If any middleware returns nil, NO dispatch will occur (i.e. the event will be filtered).

The example-config source code contains further settings and details. See also set-config!, merge-config!, set-level!.

Example (+default) Timbre v4 config map.

APPENDERS
  An appender is a map with keys:
    :min-level       ; Level keyword, or nil (=> no minimum level)
    :enabled?        ;
    :async?          ; Dispatch using agent? Useful for slow appenders (clj only)
    :rate-limit      ; [[ncalls-limit window-ms] <...>], or nil
    :output-fn       ; Optional override for inherited (fn [data]) -> string
    :timestamp-opts  ; Optional override for inherited {:pattern _ :locale _ :timezone _} (clj only)
    :ns-whitelist    ; Optional, stacks with active config's whitelist
    :ns-blacklist    ; Optional, stacks with active config's blacklist
    :fn              ; (fn [data]) -> side effects, with keys described below

  An appender's fn takes a single data map with keys:
    :config          ; Entire config map (this map, etc.)
    :appender-id     ; Id of appender currently dispatching
    :appender        ; Entire map of appender currently dispatching
    :instant         ; Platform date (java.util.Date or js/Date)
    :level           ; Keyword
    :error-level?    ; Is level e/o #{:error :fatal}?
    :?ns-str         ; String,  or nil
    :?file           ; String,  or nil
    :?line           ; Integer, or nil ; Waiting on CLJ-865
    :?err            ; First-arg platform error, or nil
    :vargs           ; Vector of raw args
    :output_         ; Forceable - final formatted output string created
                     ; by calling (output-fn <this-data-map>)
    :msg_            ; Forceable - args as a string
    :timestamp_      ; Forceable - string (clj only)
    :hostname_       ; Forceable - string (clj only)
    :output-fn       ; (fn [data]) -> formatted output string
                     ; (see `default-output-fn` for details)
    :context         ; *context* value at log time (see `with-context`)

    **NB** - any keys not specifically documented here should be
    considered private / subject to change without notice.

MIDDLEWARE
  Middleware are simple (fn [data]) -> ?data fns (applied left->right) that
  transform the data map dispatched to appender fns. If any middleware
  returns nil, NO dispatch will occur (i.e. the event will be filtered).

The `example-config` source code contains further settings and details.
See also `set-config!`, `merge-config!`, `set-level!`.
sourceraw docstring

fatalcljsmacro

(fatal & args)
source

fatalfcljsmacro

(fatalf & args)
source

get-envcljsmacro

(get-env)
source

get-hostnamecljs

source

infocljsmacro

(info & args)
source

infofcljsmacro

(infof & args)
source

level>=cljs

(level>= x y)
source

logcljsmacro

(log level & args)
source

log!cljsmacro

(log! level msg-type args & [opts])

Core low-level log macro. Useful for tooling, etc.

  • level - must eval to a valid logging level
  • msg-type - must eval to e/o #{:p :f nil}
  • opts - ks e/o #{:config :?err :?ns-str :?file :?line :?base-data}

Supports compile-time elision when compile-time const vals provided for level and/or ?ns-str.

Core low-level log macro. Useful for tooling, etc.

  * `level`    - must eval to a valid logging level
  * `msg-type` - must eval to e/o #{:p :f nil}
  * `opts`     - ks e/o #{:config :?err :?ns-str :?file :?line :?base-data}

Supports compile-time elision when compile-time const vals
provided for `level` and/or `?ns-str`.
sourceraw docstring

log*cljsmacro

(log* config level & args)
source

log-and-rethrow-errorscljsmacro

(log-and-rethrow-errors & body)
source

log-envcljsmacro

(log-env)
(log-env level)
(log-env level name)
(log-env config level name)
source

log-errorscljsmacro

(log-errors & body)
source

log?cljs

source

logfcljsmacro

(logf level & args)
source

logf*cljsmacro

(logf* config level & args)
source

logged-futurecljsmacro

(logged-future & body)
source

logging-enabled?cljs

(logging-enabled? level compile-time-ns)
source

logpcljsmacro

(logp & args)
source

may-log?cljs

(may-log? level)
(may-log? level ?ns-str)
(may-log? level ?ns-str ?config)

Runtime check: would Timbre currently log at the given logging level?

  • ?ns-str arg required to support ns filtering
  • config arg required to support non-global config
Runtime check: would Timbre currently log at the given logging level?
* `?ns-str` arg required to support ns filtering
* `config`  arg required to support non-global config
sourceraw docstring

merge-config!cljs

(merge-config! m)
source

ordered-levelscljs

source

println-appendercljs

source

reportcljsmacro

(report & args)
source

reportfcljsmacro

(reportf & args)
source

set-config!cljs

(set-config! m)
source

set-level!cljs

(set-level! level)
source

sometimescljsmacro

(sometimes probability & body)

Handy for sampled logging, etc.

Handy for sampled logging, etc.
sourceraw docstring

spycljsmacro

(spy expr)
(spy level expr)
(spy level name expr)
(spy config level name expr)

Evaluates named expression and logs its result. Always returns the result. Defaults to :debug logging level and unevaluated expression as name.

Evaluates named expression and logs its result. Always returns the result.
Defaults to :debug logging level and unevaluated expression as name.
sourceraw docstring

stacktracecljs

(stacktrace err)
(stacktrace err opts)
source

str-printlncljs

(str-println & xs)
source

swap-config!cljs

(swap-config! f & args)
source

tracecljsmacro

(trace & args)
source

tracefcljsmacro

(tracef & args)
source

valid-levelcljs

(valid-level x)
source

valid-level?cljs

(valid-level? x)
source

warncljsmacro

(warn & args)
source

warnfcljsmacro

(warnf & args)
source

with-configcljsmacro

(with-config config & body)
source

with-contextcljsmacro

(with-context context & body)

Executes body so that given arbitrary data will be included in the data map passed to appenders for any enclosed logging calls.

(with-context {:user-name "Stu"} ; Will be incl. in data dispatched to appenders (info "User request"))

Executes body so that given arbitrary data will be included in the
data map passed to appenders for any enclosed logging calls.

(with-context
  {:user-name "Stu"} ; Will be incl. in data dispatched to appenders
  (info "User request"))
sourceraw docstring

with-default-outscljsmacro

(with-default-outs & body)
source

with-levelcljsmacro

(with-level level & body)
source

with-log-levelcljsmacro

(with-log-level level & body)
source

with-logging-configcljsmacro

(with-logging-config config & body)
source

with-merged-configcljsmacro

(with-merged-config config & body)
source

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

× close