Last active
March 21, 2017 07:30
-
-
Save lucian303/462d620749a068e7f3ca128a0798a8ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn sentry-appender | |
"Add a timbre appender for sending logs to Sentry.io" | |
[app-ns] | |
{:enabled? true | |
:async? true | |
:min-level :warn | |
:rate-limit nil | |
:output-fn :inherit | |
:fn | |
(fn [data] | |
(let [{:keys [?err ?line ?file ?ns-str level]} data] | |
(capture (env :sentry-url) | |
(-> {:message (str level ": " ?err " at line " ?line " in file " ?file " in NS " ?ns-str)} | |
(stacktrace ?err app-ns)))))}) | |
(timbre/merge-config! {:appenders {:sentry (sentry-appender ["api-proxy"])}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment