Skip to content

Instantly share code, notes, and snippets.

@RickMoynihan
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save RickMoynihan/9e64dafe5e9715c2766d to your computer and use it in GitHub Desktop.

Select an option

Save RickMoynihan/9e64dafe5e9715c2766d to your computer and use it in GitHub Desktop.
Simple timbre logging macro to log the contents of the current lexical environment
(defmacro log-env
([] `(log-env :info))
([level] `(log-env ~level "Captured Environment is"))
([level message] `(log/log ~level ~message (zipmap (quote ~(keys &env)) [~@(keys &env)]))))
user> ((fn [a] (let [b 10] (log-env :info "The current lexical environment is:"))) "function argument")
2015-Jun-12 11:55:12 +0100 mccarthy.lan INFO [user] - The current lexical environment is: {a "function argument", b 10}
;; => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment