taoensso / timbre

Pure Clojure/Script logging library
https://www.taoensso.com/timbre
Eclipse Public License 1.0
1.44k stars 171 forks source link

Function's context in appender #327

Closed viebel closed 3 years ago

viebel commented 3 years ago

Is there a way - as an appender - to know in what function timbre/info has been called?

ptaoussanis commented 3 years ago

@viebel Hi Yehonathan, unfortunately not in what function- just what namespace.

viebel commented 3 years ago

What would it take to submit a PR that passes to appender the function info?

ptaoussanis commented 3 years ago

Off the top of my head, can't think of any practical way of doing this - I don't suspect it'd be easy.

Basically- you'd need some way of passing a function's info to macro calls in the function body. I guess you could try mod the defn macro (or make a variation of defn) that sets up a binding of the fn name for the duration of the evaluation of the body form?

Actually, maybe that wouldn't be too difficult. Would still call it non-trivial though. And you'd need to use the custom defn macro.