mirror of https://github.com/status-im/timbre.git
Remove restriction on :throwable, default to all but :ap-config
This commit is contained in:
parent
f802ede826
commit
b7ec7ae71b
|
@ -5,10 +5,6 @@
|
||||||
|
|
||||||
(def conn (atom nil))
|
(def conn (atom nil))
|
||||||
|
|
||||||
;; Note: including :throwable will fail with:
|
|
||||||
;; IllegalArgumentException: can't serialize class java.lang.Exception
|
|
||||||
(def default-keys [:hostname :ns :level :error? :instant :message :args])
|
|
||||||
|
|
||||||
(def default-args {:host "127.0.0.1" :port 27017})
|
(def default-args {:host "127.0.0.1" :port 27017})
|
||||||
|
|
||||||
(defn connect [{:keys [db server write-concern]}]
|
(defn connect [{:keys [db server write-concern]}]
|
||||||
|
@ -22,10 +18,15 @@
|
||||||
(swap! conn #(or % (connect config))))
|
(swap! conn #(or % (connect config))))
|
||||||
|
|
||||||
(defn log-message [params {:keys [collection logged-keys]
|
(defn log-message [params {:keys [collection logged-keys]
|
||||||
:or {logged-keys default-keys}
|
|
||||||
:as config}]
|
:as config}]
|
||||||
(mongo/with-mongo (ensure-conn config)
|
(let [selected-params (if logged-keys
|
||||||
(mongo/insert! collection (select-keys params logged-keys))))
|
(select-keys params logged-keys)
|
||||||
|
(dissoc params :ap-config))
|
||||||
|
logged-params (if-let [t (:throwable selected-params)]
|
||||||
|
(assoc selected-params :throwable (str t))
|
||||||
|
selected-params)]
|
||||||
|
(mongo/with-mongo (ensure-conn config)
|
||||||
|
(mongo/insert! collection logged-params))))
|
||||||
|
|
||||||
(defn appender-fn [{:keys [ap-config] :as params}]
|
(defn appender-fn [{:keys [ap-config] :as params}]
|
||||||
(when-let [mongo-config (:mongo ap-config)]
|
(when-let [mongo-config (:mongo ap-config)]
|
||||||
|
|
Loading…
Reference in New Issue