File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 11
11
namespace net = network;
12
12
namespace http = network::http;
13
13
14
+ #include < network/logging/logging.hpp>
15
+ #include < fstream>
16
+
17
+ class test_log_handler
18
+ {
19
+ public:
20
+ test_log_handler () : log_file( " cppnetlib.log" ) { }
21
+ void operator ()( const network::logging::log_record& log )
22
+ {
23
+ const auto message = log.full_message ();
24
+ std::cerr << message << std::endl;
25
+ log_file << message << std::endl;
26
+ }
27
+
28
+ private:
29
+
30
+ std::ofstream log_file;
31
+ };
32
+
33
+ void setup_test_log ()
34
+ {
35
+ network::logging::set_log_record_handler ( []( const network::logging::log_record& log ){
36
+ static test_log_handler handler;
37
+ handler (log);
38
+ } );
39
+ }
40
+
14
41
BOOST_AUTO_TEST_CASE (http_client_get_test) {
42
+ setup_test_log ();
15
43
http::client::request request (" http://www.google.com/" );
16
44
request << net::header (" Connection" , " close" );
17
45
http::client client_;
@@ -33,6 +61,7 @@ BOOST_AUTO_TEST_CASE(http_client_get_test) {
33
61
#ifdef NETWORK_ENABLE_HTTPS
34
62
35
63
BOOST_AUTO_TEST_CASE (https_client_get_test) {
64
+ setup_test_log ();
36
65
http::client::request request (" https://www.google.com" );
37
66
request << net::header (" Connection" , " close" );
38
67
http::client client_;
You can’t perform that action at this time.
0 commit comments