Makes logging unified
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
(:require [com.unbounce.dogstatsd.core :as statsd]
|
||||
[mount.core :as mount]
|
||||
[clj-http.client :as http]
|
||||
[clojure.tools.logging :as log]
|
||||
[auto-ap.logging :as alog]
|
||||
[config.core :refer [env]]
|
||||
[unilog.context :as lc]
|
||||
[com.brunobonacci.mulog :as mu]))
|
||||
|
||||
(defn get-container-data []
|
||||
@@ -16,7 +15,8 @@
|
||||
:body)]
|
||||
result)
|
||||
(catch Exception e
|
||||
(log/warn "cannot find container tags" e)
|
||||
(alog/error ::no-container-tags
|
||||
:error e)
|
||||
{})))
|
||||
|
||||
(mount/defstate container-data
|
||||
@@ -34,8 +34,6 @@
|
||||
|
||||
(defn set-logging-context []
|
||||
(when (seq container-data)
|
||||
(lc/push-context "container" (:DockerId container-data))
|
||||
(lc/push-context "ip" (-> container-data :Networks first :IPv4Addresses first))
|
||||
|
||||
(mu/start-publisher! {:type :console-json
|
||||
:transform (fn [events]
|
||||
@@ -56,8 +54,7 @@
|
||||
|
||||
(defn stop-logging-context []
|
||||
(when (seq container-data)
|
||||
(lc/pull-context "container")
|
||||
(lc/pull-context "ip")))
|
||||
))
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(mount/defstate logging-context
|
||||
|
||||
Reference in New Issue
Block a user