diff --git a/src/clj/automaton_core/log/be_log.clj b/src/clj/automaton_core/log/be_log.clj index afa35ae2..9155c46b 100644 --- a/src/clj/automaton_core/log/be_log.clj +++ b/src/clj/automaton_core/log/be_log.clj @@ -14,7 +14,12 @@ (defn- logger-ids-to-logger-fns "Based on logger-id chooses from registered strategies which logging function to use." [logger-ids] - (reduce (fn [acc logger-id] (conj acc (get-in log-be-registry/strategies-registry [logger-id :impl]))) [] logger-ids)) + (reduce (fn [acc logger-id] + (if-let [logger-strategy (get-in log-be-registry/strategies-registry [logger-id :impl])] + (conj acc logger-strategy) + (do (print "WARN: Logging strategy is nil for id: " logger-id) acc))) + [] + logger-ids)) (defmacro log [logger-ids level & message] diff --git a/src/clj/automaton_core/log/be_registry.clj b/src/clj/automaton_core/log/be_registry.clj index 76248372..128eb08e 100644 --- a/src/clj/automaton_core/log/be_registry.clj +++ b/src/clj/automaton_core/log/be_registry.clj @@ -19,7 +19,7 @@ :impl automaton-core.log.impl.log4j2/log-fn} ::log-registry/no-op {:description "Deactivate that log" :impl no-op-fn} - ::log-registry/error-tracking {:description "For monitoring exceptions in the application" - :impl automaton-core.log.tracking.be-error-tracking/add-context} + ::log-registry/error-tracking-context {:description "For monitoring exceptions in the application" + :impl automaton-core.log.tracking.be-error-tracking/add-context} ::log-registry/error-tracking-alert {:description "For alerting about monitoring exceptions in the application" :impl automaton-core.log.tracking.be-error-tracking/error-alert}}) diff --git a/src/clj/automaton_core/log/tracking/be_error_tracking.clj b/src/clj/automaton_core/log/tracking/be_error_tracking.clj index fb271787..e42d700b 100644 --- a/src/clj/automaton_core/log/tracking/be_error_tracking.clj +++ b/src/clj/automaton_core/log/tracking/be_error_tracking.clj @@ -11,7 +11,7 @@ (defn- sentry-data [ns level & message] - (let [context (if (map? (first message)) (merge (first message) {:ns ns}) {:ns ns}) + (let [context (if (map? (first message)) (merge (first message) (when ns {:ns ns})) (when ns {:ns ns})) message (if (map? (first message)) (rest message) message)] {:message message :level level diff --git a/src/cljc/automaton_core/utils/map.cljc b/src/cljc/automaton_core/utils/map.cljc index cfd81f4b..50da3bea 100644 --- a/src/cljc/automaton_core/utils/map.cljc +++ b/src/cljc/automaton_core/utils/map.cljc @@ -98,7 +98,12 @@ (defn map-util-hashmappify-vals "Converts an ordinary Clojure map into a Clojure map with nested map values recursively translated into what modify-type-fn is returning. Based - on walk/stringify-keys." + on walk/stringify-keys. + When key or value is nil, the pair is removed, as the hashmap doesn't allow null keys/values." [m modify-type-fn] - (let [f (fn [[k v]] (let [k (if (keyword? k) (name k) k) v (if (keyword? v) (name v) v)] (if (map? v) [k (modify-type-fn v)] [k v])))] + (let [f (fn [[k v]] + (let [k (if (keyword? k) (str (symbol k)) k) + v (if (keyword? v) (str (symbol v)) v)] + (cond (map? v) [k (modify-type-fn v)] + (and (some? v) (some? k)) [k v])))] (walk/postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m))) diff --git a/version.edn b/version.edn index 19a174bb..17048c31 100644 --- a/version.edn +++ b/version.edn @@ -1,4 +1,4 @@ ;;Last generated version, note a failed push consume a number {:major-version "0.0.-1" - :minor-version 25 - :version "0.0.25"} \ No newline at end of file + :minor-version 26 + :version "0.0.26"} \ No newline at end of file