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