re-frame/docs/FAQs/Logging.md

34 lines
973 B
Markdown
Raw Normal View History

2016-08-29 12:57:35 +00:00
### Question
I use logging method X, how can I make re-frame use my method?
2016-08-29 13:06:41 +00:00
### Answer
2016-08-29 12:57:35 +00:00
re-frame makes use of the logging functions: `warn`, `log`, `error`, `group` and `groupEnd`.
By default, these functions map directly to the js/console equivalents, but you can
override that by providing your own set or subset of these functions using
`re-frame.core/set-loggers!` like this:
```clj
(defn my-warn
[& args]
2016-08-29 13:49:00 +00:00
(post-warning-somewhere (apply str args)))
2016-08-29 12:57:35 +00:00
(defn my-log
[& args]
2016-08-29 13:49:00 +00:00
(write-to-datadog (apply str args)))
2016-08-29 12:57:35 +00:00
(re-frame.core/set-loggers! {:warn my-warn
:log my-log
...})
```
2016-08-29 13:06:41 +00:00
***
2016-08-29 13:06:41 +00:00
Up: [FAQ Index](README.md)      
2016-12-18 12:42:45 +00:00
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
<!-- END doctoc generated TOC please keep comment here to allow auto update -->