Skip to content

Commit 46687c8

Browse files
ararslanquinnj
andauthored
Make debugging macros insert branches on DEBUG_LEVEL (#356)
Co-authored-by: Jacob Quinn <quinn.jacobd@gmail.com>
1 parent 09e03d1 commit 46687c8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/debug.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ taskid(t=current_task()) = string(hash(t) & 0xffff, base=16, pad=4)
33
debug_header() = string("DEBUG: ", rpad(Dates.now(), 24), taskid(), " ")
44

55
macro debug(n::Int, s)
6-
DEBUG_LEVEL[] >= n ? :(println(debug_header(), $(esc(s)))) :
7-
:()
6+
quote
7+
if DEBUG_LEVEL[] >= $n
8+
println(debug_header(), $(esc(s)))
9+
end
10+
end
811
end
912

1013
sprintcompact(x) = sprint(show, x; context=:compact => true)

0 commit comments

Comments
 (0)