Skip to content

Commit 9e98160

Browse files
committed
Define BOOST_NETWORK_MESSAGE if BOOST_NETWORK_DEBUG
The internal macro BOOST_NETWORK_MESSAGE is meant to insert debugging output that by default prints to std::cerr. This macro is only enabled if BOOST_NETWORK_DEBUG is defined. This is not meant to be exposed and is only meant to be for debugging purposes during development.
1 parent 930013f commit 9e98160

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

boost/network/detail/debug.hpp

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef BOOST_NETWORK_DEBUG_HPP_20110410
2+
#define BOOST_NETWORK_DEBUG_HPP_20110410
3+
4+
// (c) Copyright 2011 Dean Michael Berris.
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
/** BOOST_NETWORK_MESSAGE is a debugging macro used by cpp-netlib to
10+
print out network-related errors through standard error. This is
11+
only useful when BOOST_NETWORK_DEBUG is turned on. Otherwise
12+
the macro amounts to a no-op.
13+
*/
14+
#ifdef BOOST_NETWORK_DEBUG
15+
# include <iostream>
16+
# ifndef BOOST_NETWORK_MESSAGE
17+
# define BOOST_NETWORK_MESSAGE(msg) std::cerr << "[DEBUG " << __FILE__ << ':' << __LINE__ << "]: " << msg << std::endl;
18+
# endif
19+
#else
20+
# ifndef BOOST_NETWORK_MESSAGE
21+
# define BOOST_NETWORK_MESSAGE(msg)
22+
# endif
23+
#endif
24+
25+
#endif /* end of include guard: BOOST_NETWORK_DEBUG_HPP_20110410 */

libs/network/test/Jamfile.v2

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ project network_test :
2424
<source>/boost//thread
2525
<source>/boost//filesystem
2626
<define>BOOST_NETWORK_ENABLE_HTTPS
27+
<variant>debug:<define>BOOST_NETWORK_DEBUG
2728
<toolset>gcc:<linkflags>-lpthread
2829
<toolset>gcc:<linkflags>-lssl
2930
<toolset>gcc:<linkflags>-lcrypto

libs/network/test/http/Jamfile.v2

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ project network_test/http :
1212
requirements
1313
<include>../../../../
1414
<include>../
15+
<variant>debug:<define>BOOST_NETWORK_DEBUG
1516
;
1617

1718
run client_constructor_test.cpp /cpp-netlib//cppnetlib-uri-parsers ;

0 commit comments

Comments
 (0)