mirror of
https://github.com/penpot/penpot.git
synced 2025-05-12 06:26:37 +02:00
✨ Add unique id (uuid) on each log entry
This commit is contained in:
parent
e8426006e3
commit
256ed7410f
2 changed files with 7 additions and 6 deletions
|
@ -49,7 +49,7 @@
|
||||||
(assoc :host (cf/get :host))
|
(assoc :host (cf/get :host))
|
||||||
(assoc :public-uri (cf/get :public-uri))
|
(assoc :public-uri (cf/get :public-uri))
|
||||||
(assoc :version (:full cf/version))
|
(assoc :version (:full cf/version))
|
||||||
(assoc :id (uuid/next))))
|
(update :id #(or % (uuid/next)))))
|
||||||
|
|
||||||
(defn handle-event
|
(defn handle-event
|
||||||
[{:keys [executor] :as cfg} event]
|
[{:keys [executor] :as cfg} event]
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
(ns app.common.logging
|
(ns app.common.logging
|
||||||
(:require
|
(:require
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
|
[app.common.uuid :as uuid]
|
||||||
[clojure.pprint :refer [pprint]]
|
[clojure.pprint :refer [pprint]]
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
[fipp.edn :as fpp]
|
[fipp.edn :as fpp]
|
||||||
|
@ -35,12 +36,12 @@
|
||||||
(reduce-kv #(.with ^MapMessage %1 (name %2) %3) message m))))
|
(reduce-kv #(.with ^MapMessage %1 (name %2) %3) message m))))
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(def logger-context
|
(def logger-context
|
||||||
(LogManager/getContext false)))
|
(LogManager/getContext false)))
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(def logging-agent
|
(def logging-agent
|
||||||
(agent nil :error-mode :continue)))
|
(agent nil :error-mode :continue)))
|
||||||
|
|
||||||
(defn- simple-prune
|
(defn- simple-prune
|
||||||
([s] (simple-prune s (* 1024 1024)))
|
([s] (simple-prune s (* 1024 1024)))
|
||||||
|
@ -175,7 +176,7 @@
|
||||||
`(->> (ThreadContext/getImmutableContext)
|
`(->> (ThreadContext/getImmutableContext)
|
||||||
(send-off logging-agent
|
(send-off logging-agent
|
||||||
(fn [_# cdata#]
|
(fn [_# cdata#]
|
||||||
(with-context (-> {} (into cdata#) (into ~context))
|
(with-context (-> {:id (uuid/next)} (into cdata#) (into ~context))
|
||||||
(->> (or ~raw (build-map-message ~props))
|
(->> (or ~raw (build-map-message ~props))
|
||||||
(write-log! ~logger-sym ~level-sym ~cause))))))
|
(write-log! ~logger-sym ~level-sym ~cause))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue