Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 86 lines (49 sloc) 2.187 kb
21abc5b @klacke Initial revision
authored
1 %%%----------------------------------------------------------------------
2 %%% File : yaws_debug.hrl
3 %%% Author : Claes Wikstrom <klacke@hyber.org>
455578a @vinoski major trailing whitespace cleanup
vinoski authored
4 %%% Purpose :
21abc5b @klacke Initial revision
authored
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),
0be3c7e @klacke untabified all of yaws
authored
13 lists:flatten(io_lib:format(Format,Args))).
21abc5b @klacke Initial revision
authored
14
15 -define(f(L), lists:flatten(L)).
16
17 -define(W(A), ?F("~w", [A])).
18
19 -define(format_record(Rec, Name),
0be3c7e @klacke untabified all of yaws
authored
20 yaws_debug:format_record(Rec, Name, record_info(fields, Name))).
455578a @vinoski major trailing whitespace cleanup
vinoski authored
21
21abc5b @klacke Initial revision
authored
22
383388d @klacke when a gserv() dies, exit app + 302 without content shall have a conten ...
authored
23
24 -define(Trace(What, Fmt, Args), if Trace == false ->
0be3c7e @klacke untabified all of yaws
authored
25 ok;
26 _ ->
27 yaws_debug:dtrace(What,Fmt,Args)
28 end).
383388d @klacke when a gserv() dies, exit app + 302 without content shall have a conten ...
authored
29
30
31
21abc5b @klacke Initial revision
authored
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),
0be3c7e @klacke untabified all of yaws
authored
42 yaws_debug:assert(Op,X,Y,{assert,?FILE,?LINE,Msg})).
21abc5b @klacke Initial revision
authored
43
44
45 -define(Dalert(X,Op,Y,Msg),
0be3c7e @klacke untabified all of yaws
authored
46 yaws_debug:assert(Op,X,Y,{alert,?FILE,?LINE,Msg})).
21abc5b @klacke Initial revision
authored
47
48 -define(Deval(Expr),Expr).
49
50 -define(Debug(F, A),
0be3c7e @klacke untabified all of yaws
authored
51 yaws_debug:assert([],0,0,{{debug,"DEBUG"}, ?FILE,?LINE,F, A})).
21abc5b @klacke Initial revision
authored
52
383388d @klacke when a gserv() dies, exit app + 302 without content shall have a conten ...
authored
53
21abc5b @klacke Initial revision
authored
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
455578a @vinoski major trailing whitespace cleanup
vinoski authored
68 -define(Dfunassert(Fun, Msg),
0be3c7e @klacke untabified all of yaws
authored
69 yaws_debug:assert('fun', Fun, 0, {assert,?FILE,?LINE,Msg})).
21abc5b @klacke Initial revision
authored
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).
455578a @vinoski major trailing whitespace cleanup
vinoski authored
83
21abc5b @klacke Initial revision
authored
84 -endif. %% debug defined
85
Something went wrong with that request. Please try again.