mirror of
https://github.com/penpot/penpot.git
synced 2025-02-09 00:28:20 -05:00
💄 Make cleaner debug logs
This commit is contained in:
parent
c98635bca1
commit
de1a3de433
1 changed files with 14 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
|
[app.common.math :as mth]
|
||||||
[app.common.transit :as t]
|
[app.common.transit :as t]
|
||||||
[app.common.types.file :as ctf]
|
[app.common.types.file :as ctf]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
|
@ -120,17 +121,28 @@
|
||||||
(effect-fn input)
|
(effect-fn input)
|
||||||
(rf result input)))))
|
(rf result input)))))
|
||||||
|
|
||||||
|
(defn prettify
|
||||||
|
"Prepare x fror cleaner output when logged."
|
||||||
|
[x]
|
||||||
|
(cond
|
||||||
|
(map? x) (d/mapm #(prettify %2) x)
|
||||||
|
(vector? x) (mapv prettify x)
|
||||||
|
(seq? x) (map prettify x)
|
||||||
|
(set? x) (into #{} (map prettify x))
|
||||||
|
(number? x) (mth/precision x 4)
|
||||||
|
(uuid? x) (str "#uuid " x)
|
||||||
|
:else x))
|
||||||
|
|
||||||
(defn ^:export logjs
|
(defn ^:export logjs
|
||||||
([str] (tap (partial logjs str)))
|
([str] (tap (partial logjs str)))
|
||||||
([str val]
|
([str val]
|
||||||
(js/console.log str (clj->js val))
|
(js/console.log str (clj->js (prettify val)))
|
||||||
val))
|
val))
|
||||||
|
|
||||||
(when (exists? js/window)
|
(when (exists? js/window)
|
||||||
(set! (.-dbg ^js js/window) clj->js)
|
(set! (.-dbg ^js js/window) clj->js)
|
||||||
(set! (.-pp ^js js/window) pprint))
|
(set! (.-pp ^js js/window) pprint))
|
||||||
|
|
||||||
|
|
||||||
(defonce widget-style "
|
(defonce widget-style "
|
||||||
background: black;
|
background: black;
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
|
|
Loading…
Add table
Reference in a new issue