lib: added warning checks for unsupported recursion fields in vevent.cc
[barry/progweb.git] / src / debug.h
blobe0334ab51802851e5bfb7df47f49ecc3ebd5e2aa
1 /*
2 Copyright (C) 2005-2012, 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>
19 #include "common.h"
20 #include "log.h"
22 #ifndef __BARRY_DEBUG_H__ // only protect the non-macro portion, in order
23 #define __BARRY_DEBUG_H__ // to allow re-inclusion of debug.h with
24 // different __DEBUG_MODE__ settings
26 namespace Barry {
27 extern bool __data_dump_mode__;
28 extern std::ostream *LogStream;
31 #endif // __BARRY_DEBUG_H__
33 // data dump output - controlled by command line -v switch
34 #define ddout(x) if(::Barry::__data_dump_mode__) { ::Barry::LogLock lock; (*::Barry::LogStream) << x << std::endl; }
36 #ifdef __DEBUG_MODE__
37 // debugging on
38 #undef dout
39 #undef eout
41 // low level debug output
42 #define dout(x) if(::Barry::__data_dump_mode__) { ::Barry::LogLock lock; (*::Barry::LogStream) << x << std::endl; }
43 // #define dout(x)
45 // exception output
46 #define eout(x) { ::Barry::LogLock lock; (*::Barry::LogStream) << x << std::endl; }
48 // easy exception output
49 #define eeout(c, r) { ::Barry::LogLock lock; (*::Barry::LogStream) << "Sent packet:\n" << c << "\n" << "Response packet:\n" << r << "\n"; }
51 // handle assert()
52 #undef NDEBUG
53 #else
55 // debugging off
56 #undef dout
57 #undef eout
59 #define dout(x)
60 #define eout(x) { ::Barry::LogLock lock; (*::Barry::LogStream) << x << std::endl; }
61 #define eeout(c, r) { ::Barry::LogLock lock; (*::Barry::LogStream) << "Sent packet:\n" << c << "\n" << "Response packet:\n" << r << "\n"; }
63 // handle assert() as well
64 #undef NDEBUG
65 #define NDEBUG
66 #endif
68 #include <assert.h>