Skip to content
This repository
Newer
Older
100644 84 lines (49 sloc) 2.187 kb
21abc5ba »
2002-02-11 Initial revision
1 %%%----------------------------------------------------------------------
2 %%% File : yaws_debug.hrl
3 %%% Author : Claes Wikstrom <klacke@hyber.org>
455578a2 » vinoski
2011-04-19 major trailing whitespace cleanup
4 %%% Purpose :
21abc5ba »
2002-02-11 Initial revision
5 %%% Created : 7 Feb 2002 by Claes Wikstrom <klacke@hyber.org>
6 %%%----------------------------------------------------------------------
7
8 -author('klacke@hyber.org').
9
10
11
12 -define(F(Format,Args),
0be3c7e8 »
2008-02-14 untabified all of yaws
13 lists:flatten(io_lib:format(Format,Args))).
21abc5ba »
2002-02-11 Initial revision
14
15 -define(f(L), lists:flatten(L)).
16
17 -define(W(A), ?F("~w", [A])).
18
19 -define(format_record(Rec, Name),
0be3c7e8 »
2008-02-14 untabified all of yaws
20 yaws_debug:format_record(Rec, Name, record_info(fields, Name))).
455578a2 » vinoski
2011-04-19 major trailing whitespace cleanup
21
21abc5ba »
2002-02-11 Initial revision
22
383388d1 »
2003-05-13 when a gserv() dies, exit app + 302 without content shall have a cont…
23
24 -define(Trace(What, Fmt, Args), if Trace == false ->
0be3c7e8 »
2008-02-14 untabified all of yaws
25 ok;
26 _ ->
27 yaws_debug:dtrace(What,Fmt,Args)
28 end).
383388d1 »
2003-05-13 when a gserv() dies, exit app + 302 without content shall have a cont…
29
30
31
21abc5ba »
2002-02-11 Initial revision
32 -ifdef(debug).
33
34
35 %% Possible Ops are, equal | neq | integer | list | {list, length, equal}
36 %% | greater | min | max | interval | {in, X , List}
37
38
39
40
41 -define(Dassert(X,Op,Y,Msg),
0be3c7e8 »
2008-02-14 untabified all of yaws
42 yaws_debug:assert(Op,X,Y,{assert,?FILE,?LINE,Msg})).
21abc5ba »
2002-02-11 Initial revision
43
44
45 -define(Dalert(X,Op,Y,Msg),
0be3c7e8 »
2008-02-14 untabified all of yaws
46 yaws_debug:assert(Op,X,Y,{alert,?FILE,?LINE,Msg})).
21abc5ba »
2002-02-11 Initial revision
47
48 -define(Deval(Expr),Expr).
49
50 -define(Debug(F, A),
0be3c7e8 »
2008-02-14 untabified all of yaws
51 yaws_debug:assert([],0,0,{{debug,"DEBUG"}, ?FILE,?LINE,F, A})).
21abc5ba »
2002-02-11 Initial revision
52
383388d1 »
2003-05-13 when a gserv() dies, exit app + 302 without content shall have a cont…
53
21abc5ba »
2002-02-11 Initial revision
54 %% ease of use, just do ?Dvar(Variable)
55 -define(Dvar(Var), ?Debug("Var = ~p~n", [Var])).
56
57 -define(TC(L), yaws_debug:typecheck(L, ?FILE, ?LINE)).
58
59
60 -define(Derror(Fmt,Args),
61 yaws_debug:assert([],0,0,{{debug,"ERROR"}, ?FILE,?LINE,Fmt,Args})).
62
63
64 -define(Dformat(Fmt,Args),
65 yaws_debug:assert([],0,0,{format, ?FILE,?LINE,Fmt,Args})).
66
67
455578a2 » vinoski
2011-04-19 major trailing whitespace cleanup
68 -define(Dfunassert(Fun, Msg),
0be3c7e8 »
2008-02-14 untabified all of yaws
69 yaws_debug:assert('fun', Fun, 0, {assert,?FILE,?LINE,Msg})).
21abc5ba »
2002-02-11 Initial revision
70
71 -else. %% not debug_mode
72
73 -define(DLOG(F, A), ?LOG(F, A)).
74 -define(Dassert(X,Op,Y,Msg),debug_disabled).
75 -define(Dalert(X,Op,Y,Msg),debug_disabled).
76 -define(Deval(Expr),debug_disabled).
77 -define(Debug(F, A),debug_disabled).
78 -define(Dvar(Var), debug_disabled).
79 -define(Dformat(Fmt,Args),debug_disabled).
80 -define(Dfunassert(Fun, Msg), debug_disabled).
81 -define(Derror(Fmt,Args),debug_disabled).
82 -define(TC(L), debug_disabled).
455578a2 » vinoski
2011-04-19 major trailing whitespace cleanup
83
21abc5ba »
2002-02-11 Initial revision
84 -endif. %% debug defined
85
Something went wrong with that request. Please try again.