Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make only timbre.core/spy pretty print? #271

Closed
ghost opened this issue Nov 30, 2018 · 1 comment
Closed

How to make only timbre.core/spy pretty print? #271

ghost opened this issue Nov 30, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 30, 2018

I would like to make only timbre.core/spy pretty print, but leave all other functions alone. How do I do that?

I already found the following function in #184 for use as a middleware:

(defn pretty-log [data]
  (update
    data
    :vargs
    (partial mapv #(if (string? %)
                     %
                     (with-out-str (pprint %))))))

For timbre.core/spy this is inconvenient, however, because it will also pretty print the part before =>, which is usually short and just makes the logs harder to scan when pretty printed. I assume what is necessary for timbre.core/spy is a macro wrapping it, but I was so far unable to produce one that worked.

@ptaoussanis
Copy link
Member

Next release of Timbre will include a :spying? argument in data sent to appenders, that should make customised handling easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant