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*clj/s

See example-config for info.

See `example-config` for info.
sourceraw docstring

*context*clj/s

General-purpose dynamic logging context

General-purpose dynamic logging context
sourceraw docstring

-elide?clj

(-elide? level-form ns-str-form)
source

-levels-mapclj/s

source

-levels-setclj/s

source

-levels-vecclj/s

source

-log!clj/s

(-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-errorsclj/smacro

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

-log-errorsclj/smacro

(-log-errors ?line & body)
source

-logged-futureclj/smacro

(-logged-future ?line & body)
source

-spyclj/smacro

(-spy ?line config level name expr)
source

color-strclj

(color-str color & xs)
source

console-?appendercljs

source

console-appendercljs

source

debugclj/smacro

(debug & args)
source

debugfclj/smacro

(debugf & args)
source

default-output-fnclj/s

(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

default-timestamp-optsclj

Controls (:timestamp_ data)

Controls (:timestamp_ data)
sourceraw docstring

errorclj/smacro

(error & args)
source

errorfclj/smacro

(errorf & args)
source

example-configclj/s

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

fatalclj/smacro

(fatal & args)
source

fatalfclj/smacro

(fatalf & args)
source

get-?hostnameclj

(get-?hostname)

Returns live local hostname, or nil.

Returns live local hostname, or nil.
sourceraw docstring

get-?hostname_clj

(get-?hostname_)

Returns a new (get-?hostname) promise.

Returns a new `(get-?hostname)` promise.
sourceraw docstring

get-envclj/smacro

(get-env)
source

get-hostnameclj/s≠

clj

Returns cached hostname string.

Returns cached hostname string.
source (clj)source (cljs)raw docstring

handle-uncaught-jvm-exceptions!clj

(handle-uncaught-jvm-exceptions! & [handler])

Sets JVM-global DefaultUncaughtExceptionHandler.

Sets JVM-global DefaultUncaughtExceptionHandler.
sourceraw docstring

infoclj/smacro

(info & args)
source

infofclj/smacro

(infof & args)
source

level>=clj/s

(level>= x y)
source

logclj/smacro

(log level & args)
source

log!clj/smacro

(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*clj/smacro

(log* config level & args)
source

log-and-rethrow-errorsclj/smacro

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

log-envclj/smacro

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

log-errorsclj/smacro

(log-errors & body)
source

log?clj/s

source

logfclj/smacro

(logf level & args)
source

logf*clj/smacro

(logf* config level & args)
source

logged-futureclj/smacro

(logged-future & body)
source

logging-enabled?clj/s

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

logpclj/smacro

(logp & args)
source

may-log?clj/s

(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!clj/s

(merge-config! m)
source

ordered-levelsclj/s

source

println-appenderclj/s≠

clj
(println-appender & [{:keys [stream] :or {stream :auto}}])

Returns a simple println appender for Clojure/Script. Use with ClojureScript requires that cljs.core/*print-fn* be set.

:stream (clj only) - e/o #{:auto :out :err :std-err :std-out <io-stream>}.

Returns a simple `println` appender for Clojure/Script.
Use with ClojureScript requires that `cljs.core/*print-fn*` be set.

:stream (clj only) - e/o #{:auto :*out* :*err* :std-err :std-out <io-stream>}.
cljs
source (clj)source (cljs)raw docstring

refer-timbreclj

(refer-timbre)

Shorthand for: (require '[taoensso.timbre :as timbre :refer (log trace debug info warn error fatal report logf tracef debugf infof warnf errorf fatalf reportf spy get-env log-env)])

Shorthand for:
(require '[taoensso.timbre :as timbre
           :refer (log  trace  debug  info  warn  error  fatal  report
                   logf tracef debugf infof warnf errorf fatalf reportf
                   spy get-env log-env)])
sourceraw docstring

reportclj/smacro

(report & args)
source

reportfclj/smacro

(reportf & args)
source

set-config!clj/s

(set-config! m)
source

set-level!clj/s

(set-level! level)
source

sometimesclj/smacro

(sometimes probability & body)

Handy for sampled logging, etc.

Handy for sampled logging, etc.
sourceraw docstring

spit-appenderclj

(spit-appender &
               [{:keys [fname append?]
                 :or {fname "./timbre-spit.log" append? true}}])

Returns a simple spit file appender for Clojure.

Returns a simple `spit` file appender for Clojure.
sourceraw docstring

spyclj/smacro

(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

stacktraceclj/s

(stacktrace err)
(stacktrace err opts)
source

str-printlnclj/s

(str-println & xs)
source

swap-config!clj/s

(swap-config! f & args)
source

traceclj/smacro

(trace & args)
source

tracefclj/smacro

(tracef & args)
source

valid-levelclj/s

(valid-level x)
source

valid-level?clj/s

(valid-level? x)
source

warnclj/smacro

(warn & args)
source

warnfclj/smacro

(warnf & args)
source

with-configclj/smacro

(with-config config & body)
source

with-contextclj/smacro

(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-outsclj/smacro

(with-default-outs & body)
source

with-levelclj/smacro

(with-level level & body)
source

with-log-levelclj/smacro

(with-log-level level & body)
source

with-logging-configclj/smacro

(with-logging-config config & body)
source

with-merged-configclj/smacro

(with-merged-config config & body)
source

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

× close