mirror of https://github.com/status-im/timbre.git
[#176] PR housekeeping
This commit is contained in:
parent
9cf8dec29c
commit
6d3fc57dbb
10
project.clj
10
project.clj
|
@ -28,9 +28,11 @@
|
|||
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
|
||||
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
|
||||
:1.9 {:dependencies [[org.clojure/clojure "1.9.0-alpha5"]]}
|
||||
:test {:dependencies [[org.clojure/tools.logging "0.3.1"]
|
||||
:test
|
||||
{:dependencies
|
||||
[[org.clojure/tools.logging "0.3.1"]
|
||||
|
||||
;; Appender deps
|
||||
;;; Appender deps
|
||||
[com.taoensso/nippy "2.11.1"]
|
||||
[com.taoensso/carmine "2.13.1"]
|
||||
[com.draines/postal "2.0.0"]
|
||||
|
@ -39,7 +41,9 @@
|
|||
[org.julienxx/clj-slack "0.5.4"]
|
||||
[org.clojure/java.jdbc "0.6.1"]
|
||||
[com.mchange/c3p0 "0.9.5.2"]
|
||||
[cheshire "5.6.2"]]}
|
||||
[cheshire "5.6.2"]
|
||||
[com.newrelic.agent.java/newrelic-agent "3.20.0"]]}
|
||||
|
||||
:dev
|
||||
[:1.9 :test :server-jvm
|
||||
{:dependencies [[org.clojure/clojurescript "1.9.36"]]
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
(ns taoensso.timbre.appenders.3rd-party.appenders.newrelic
|
||||
"A New Relic appender"
|
||||
{:author "Camilo Polymeris"}
|
||||
(:import (com.newrelic.api.agent NewRelic)
|
||||
(java.util HashMap)))
|
||||
"New Relic appender. Requires an appropriate New Relic jar,
|
||||
Ref. https://goo.gl/3Nv0QX."
|
||||
{:author "Camilo Polymeris (@polymeris)"}
|
||||
(:import [com.newrelic.api.agent NewRelic]))
|
||||
|
||||
(defn newrelic-appender
|
||||
"New Relic appender. The Java agent must be installed and configured via newrelic.yml, see
|
||||
https://docs.newrelic.com/docs/agents/java-agent/installation/java-agent-manual-installation#h2-install-agent"
|
||||
[& _]
|
||||
"New Relic appender. The Java agent must be installed and configured via
|
||||
`newrelic.yml`, Ref. https://goo.gl/hRCGFd."
|
||||
[]
|
||||
{:enabled? true
|
||||
:async? true
|
||||
:min-level :warn
|
||||
:rate-limit [[100 60000]] ;matches New Relic's own cap
|
||||
:min-level :error ; New Relic API only supports error-level logging
|
||||
:rate-limit [[100 60000]] ; Matches New Relic's own cap
|
||||
:output-fn :inherit
|
||||
:fn (fn [data]
|
||||
(let [{:keys [output-fn ?err level]} data
|
||||
params (HashMap. {"Log level" (name level)})]
|
||||
(if ?err
|
||||
(NewRelic/noticeError ?err params)
|
||||
(NewRelic/noticeError (output-fn data) params))))})
|
||||
:fn
|
||||
(fn [data]
|
||||
(let [{:keys [output_ ?err level]} data
|
||||
params (java.util.HashMap.
|
||||
{"Log level" (name level)
|
||||
;; TODO Add other stuff later?
|
||||
})]
|
||||
|
||||
(if-let [err ?err]
|
||||
(NewRelic/noticeError err params)
|
||||
(NewRelic/noticeError (force output) params))))})
|
||||
|
|
Loading…
Reference in New Issue