File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
src/com/moclojer/components Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 7373; ; If on dev `env`, does basically nothing besides setting the min
7474; ; level. On `prod` env however, an async channel waits for log events,
7575; ; which are then sent to OpenSearch.
76- (defrecord Logger [config ]
76+ (defrecord Logger [cfg ]
7777 component /Lifecycle
7878 (start [this]
79- (let [prod? (= (:env config) :prod )
79+ (let [config (:config cfg)
80+ prod? (= (:env config) :prod )
8081 os-cfg (:opensearch config)
8182 log-ch (async/chan )
8283 os-base-req (build-opensearch-base-req os-cfg)]
126127 (def logger
127128 (map->Logger
128129 {:config
129- {:env :prod
130- :opensearch
131- {:username " foobar"
132- :password " foobar"
133- :host " foobar"
134- :port 25060
135- :index " components-test-logs" }}}))
130+ {:config
131+ {:env :prod
132+ :opensearch
133+ {:username " foobar"
134+ :password " foobar"
135+ :host " foobar"
136+ :port 25060
137+ :index " components-test-logs" }}}}))
136138
137139 (component/start logger)
138140 (component/stop logger)
139141
140142 (trace ::testing-stuff {:testing? :definitely }
141- (log :error " aaaaa aaaa" {:hello true }))
143+ (log :error " aaaaa aaaa" {:hello true }))
142144 ; ;
143145 )
You can’t perform that action at this time.
0 commit comments