Skip to content

Instantly share code, notes, and snippets.

@lucian303
Last active March 21, 2017 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucian303/462d620749a068e7f3ca128a0798a8ce to your computer and use it in GitHub Desktop.
Save lucian303/462d620749a068e7f3ca128a0798a8ce to your computer and use it in GitHub Desktop.
(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