ptaoussanis/timbre — pull request #33 by aperiodic (2013-10-22 05:03:16+00:00)
Title: Fix profiling keywords.

The current implementation of the profile and pspy macros has, in my eyes, two major flaws:

1) If the keyword provided has no namespace, the namespace it is given is `taoensso.timbre.profiling`, not the namespace where the profile or pspy macro is used.
2) The keyword must be defined at macro-expand time.

The root cause of both of these problems is that `taoensso.timbre.utils/fq-keyword` is called by the macros when they are run, rather than having the call be in the expanded code. This patch fixes this by moving the call to the form returned by the macro.

It seems like the macros might have been implemented this way due to some trepidation that `utils/fq-keyword` might not be available at the macro's callsite. Fortunately, clojure's syntax-quote fully qualifies symbols inside of it, and you can use functions without requiring them as long as you refer to them by their fully-qualified names (provided their namespace has been loaded somehow, which is fine because the profiling namespace does so), so the new implementation will still work regardless of what else is required by the calling namespace.