mirror of
https://github.com/penpot/penpot.git
synced 2025-02-22 06:46:40 -05:00
🔧 Add filtering to logs in component sync algorithm
This commit is contained in:
parent
f5c913d26e
commit
ff3e3e840b
1 changed files with 21 additions and 3 deletions
|
@ -5,6 +5,7 @@
|
||||||
;; Copyright (c) KALEIDOS INC
|
;; Copyright (c) KALEIDOS INC
|
||||||
|
|
||||||
(ns app.common.logic.libraries
|
(ns app.common.logic.libraries
|
||||||
|
;; #?(:cljs (:require-macros [app.common.logic.libraries]))
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
|
@ -35,6 +36,22 @@
|
||||||
;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
|
;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
|
||||||
(log/set-level! :warn)
|
(log/set-level! :warn)
|
||||||
|
|
||||||
|
(def log-ids #{})
|
||||||
|
|
||||||
|
(defn enabled-ids?
|
||||||
|
[ids container]
|
||||||
|
(let [enabled-id?
|
||||||
|
(fn [id]
|
||||||
|
(let [parent-ids (set (cfh/get-parent-ids (:objects container) id))]
|
||||||
|
(seq (set/intersection log-ids parent-ids))))]
|
||||||
|
(or (empty? log-ids)
|
||||||
|
(some enabled-id? ids))))
|
||||||
|
|
||||||
|
(defmacro cond-log
|
||||||
|
[level ids container & params]
|
||||||
|
`(when (enabled-ids? ~ids ~container)
|
||||||
|
(log/log ~level ~@params)))
|
||||||
|
|
||||||
(declare generate-sync-container)
|
(declare generate-sync-container)
|
||||||
(declare generate-sync-shape)
|
(declare generate-sync-shape)
|
||||||
(declare generate-sync-text-shape)
|
(declare generate-sync-text-shape)
|
||||||
|
@ -736,9 +753,10 @@
|
||||||
|
|
||||||
(defn- generate-sync-shape-direct-recursive
|
(defn- generate-sync-shape-direct-recursive
|
||||||
[changes container shape-inst component library file libraries shape-main root-inst root-main reset? initial-root? redirect-shaperef components-v2]
|
[changes container shape-inst component library file libraries shape-main root-inst root-main reset? initial-root? redirect-shaperef components-v2]
|
||||||
(log/debug :msg "Sync shape direct recursive"
|
(cond-log :debug [(:id shape-inst)] container
|
||||||
:shape-inst (str (:name shape-inst) " " (pretty-uuid (:id shape-inst)))
|
:msg "Sync shape direct recursive"
|
||||||
:component (:name component))
|
:shape-inst (str (:name shape-inst) " " (pretty-uuid (:id shape-inst)))
|
||||||
|
:component (:name component))
|
||||||
|
|
||||||
(if (nil? shape-main)
|
(if (nil? shape-main)
|
||||||
;; This should not occur, but protect against it in any case
|
;; This should not occur, but protect against it in any case
|
||||||
|
|
Loading…
Add table
Reference in a new issue