Release tarball for barry-0.9
[barry.git] / src / debug.h
blob6de92bade916dd473ab664f150ab2072161148ac
1 /*
2 Copyright (C) 2005-2007, Net Direct Inc. (http://www.netdirect.ca/)
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License in the COPYING file at the
14 root directory of this project for more details.
17 #include <iostream> // debugging only
18 #include <iomanip>
20 namespace Barry {
21 extern bool __data_dump_mode__;
24 // data dump output - controlled by command line -v switch
25 #define ddout(x) if(Barry::__data_dump_mode__) std::cout << x << std::endl
27 #ifdef __DEBUG_MODE__
28 // debugging on
29 #undef dout
30 #undef eout
32 // low level debug output
33 #define dout(x) if(Barry::__data_dump_mode__) std::cout << x << std::endl
34 // #define dout(x)
36 // exception output
37 #define eout(x) std::cout << x << std::endl
39 // easy exception output
40 #define eeout(c, r) std::cout << "Sent packet:\n" << c << "\n" << "Response packet:\n" << r << "\n"
42 // handle assert()
43 #undef NDEBUG
44 #else
46 // debugging off
47 #undef dout
48 #undef eout
50 #define dout(x)
51 #define eout(x) std::cout << x << std::endl
52 #define eeout(c, r) std::cout << "Sent packet:\n" << c << "\n" << "Response packet:\n" << r << "\n"
54 // handle assert() as well
55 #define NDEBUG
56 #endif
58 #include <assert.h>