mulog
mulog copied to clipboard
Extract file/line info from callsites?
Hi Bruno,
from a quick grepping it seems that the log
macro does not extract the file and line from the callsite.
Such info would seem 1) just data, just like any other (and therefore cheap, in an "open world" following Clojure's philosophy) and 2) an overall useful piece of information that can accelerate debugging time and/or be integrated with misc tooling (e.g. something like the datadog github integration, which shows your relevant clj source code right next to your data).
I wonder if this is a feature you've considered, and if so, why would it might not be a good idea to capture this info.
Worst-case scenario, I reckon that one could craft his own minimalistic log
macro that wrapped mulog's, with an extra μ/with-context
being macroexpanded:
;; approximate pseudo-code
(defmacro log [& xs]
`(com.brunobonacci.mulog/with-context ~(select-keys (meta &env) [:file :line :column])
~(apply list 'com.brunobonacci.mulog/log xs)))
...However It would be more comfortable to stick to an official API, or at least learn a bit about your thinking.
Cheers - V