File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/com/moclojer/components Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1717 ([filepath input-map]
1818 (config/map->Config {:config (config/read-config filepath input-map)})))
1919
20+ (def setup-logger logs /setup )
21+
2022(defn new-database []
2123 (database/map->Database {}))
2224
Original file line number Diff line number Diff line change 77 (:import [clojure.core.async.impl.channels ManyToManyChannel]))
88
99(defn ->str-values
10+ " Adapts all values (including nested maps' values) from given
11+ map `m` to a string.
12+
13+ This is because OpenSearch only accepts string json values."
1014 [m]
1115 (reduce-kv
1216 (fn [acc k v]
1721 {} m))
1822
1923(defn signal->opensearch-log
24+ " Adapts a telemere signal to a pre-defined schema for OpenSearch."
2025 [{:keys [thread location] :as signal}]
2126 (-> (select-keys signal [:level :ctx :data :msg_ :error :uid :inst ])
2227 (merge {" thread/group" (:group thread)
4550
4651(defonce log-ch (atom nil ))
4752
48- (defn setup [config level env & [index]]
53+ (defn setup
54+ " If on dev `env`, does basically nothing besides setting the min
55+ level. On `prod` env however, an async channel waits for log events,
56+ which are then sent to OpenSearch."
57+ [config level env & [index]]
4958 (let [prod? (= env :prod )
5059 log-ch' (swap!
5160 log-ch
You can’t perform that action at this time.
0 commit comments