Back
console-appender (cljs)
(source)function
(console-appender & [{:keys [raw-console?]}])
Returns a simple js/console appender for ClojureScript.
Raw logging
There's 2 ways that Timbre can log to a web browser console:
1. As a prepared output string (default)
2. As a list of raw argument objects
The benefit of #2 is that it allows the browser to offer type-specific
object printing and inspection (e.g. for maps, etc.).
Raw logging can be enabled or disabled as follows:
1. On a per-call basis via a special 1st argument to your logging call:
(info ^:meta {:raw-console? true} arg1 ...)
2. Via middleware, by adding an option to your log data:
(fn my-middleware [data] (assoc data :raw-console? true))
3. Via an option provided to this appender constructor:
(console-appender {:raw-console? <bool>})
Ignoring library / "blackbox" code for accurate line numbers, etc.
Most web browsers offer a feature to ignore library or "blackbox" code
in their debugger.
You'll probably want to ignore at least the following:
`/taoensso/timbre/appenders/core\.js$` ; Timbre console appender
`/taoensso/timbre\.js$` ; Timbre core
`/cljs/core\.js$` ; ClojureScript core
Depending on the browser, you can usually set up these exclusions through
right-click popups and/or through a configurable list in a settings menu.
For example:
https://developer.chrome.com/docs/devtools/settings/ignore-list/
https://webkit.org/web-inspector/web-inspector-settings/
https://firefox-source-docs.mozilla.org/devtools-user/debugger/how_to/ignoring_sources/index.html
etc.