-
Notifications
You must be signed in to change notification settings - Fork 19
/
core.cljc
executable file
·67 lines (49 loc) · 1.75 KB
/
core.cljc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(ns debux.cs.core
#?(:cljs (:require-macros [debux.dbg :as dbg]
[debux.dbgn :as dbgn]
[debux.cs.clog :as clog]
[debux.cs.clogn :as clogn]
[debux.cs.macro-types :as mt] ))
(:require [debux.common.util :as ut]
[debux.cs.util :as cs.ut] ))
#?(:cljs (enable-console-print!))
(def set-print-seq-length! ut/set-print-seq-length!)
(defmacro set-debug-mode! [val]
`(ut/set-debug-mode! ~val))
(defmacro set-ns-whitelist! [whitelist]
`(ut/set-ns-whitelist! ~whitelist))
(defmacro set-ns-blacklist! [blacklist]
`(ut/set-ns-blacklist! ~blacklist))
;;; debugging APIs
(defmacro dbg [form & opts]
(let [ns (str *ns*)]
`(if (ut/debug-enabled? ~ns)
(debux.dbg/dbg ~form ~(ut/parse-opts opts))
~form)))
(defmacro dbgn [form & opts]
(let [ns (str *ns*)]
`(if (ut/debug-enabled? ~ns)
(debux.dbgn/dbgn ~form ~(ut/parse-opts opts))
~form)))
(defmacro clog [form & opts]
(let [ns (str *ns*)]
`(if (ut/debug-enabled? ~ns)
(debux.cs.clog/clog ~form ~(ut/parse-opts opts))
~form)))
(defmacro clogn [form & opts]
(let [ns (str *ns*)]
`(if (ut/debug-enabled? ~ns)
(debux.cs.clogn/clogn ~form ~(ut/parse-opts opts))
~form)))
(defmacro break [& opts]
(let [ns (str *ns*)]
`(when (ut/debug-enabled? ~ns)
(debux.cs.clogn/break ~(ut/parse-opts opts)))))
;;; macro registering APIs
(defmacro register-macros! [macro-type symbols]
`(debux.cs.macro-types/register-macros! ~macro-type ~symbols))
(defmacro show-macros
([] `(debux.cs.macro-types/show-macros))
([macro-type] `(debux.cs.macro-types/show-macros ~macro-type)))
;;; style option API
(def merge-styles cs.ut/merge-styles)