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
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
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; }
41 // low level debug output
42 #define dout(x) if(::Barry::__data_dump_mode__) { ::Barry::LogLock lock; (*::Barry::LogStream) << x << std::endl; }
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"; }
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