File tree Expand file tree Collapse file tree 4 files changed +10
-8
lines changed
libs/network/test/logging Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 23
23
24
24
# include < network/logging/logging.hpp>
25
25
# ifndef NETWORK_MESSAGE
26
- # define NETWORK_MESSAGE (msg ) network::logging::log_record( __FILE__, __LINE__ ) << msg;
26
+ # define NETWORK_MESSAGE (msg ) { network::logging::log ( network::logging:: log_record ( __FILE__, __LINE__ ) << msg ); }
27
27
# endif
28
28
29
29
#else
Original file line number Diff line number Diff line change @@ -51,12 +51,7 @@ class log_record
51
51
, m_line( line )
52
52
{
53
53
}
54
-
55
- ~log_record ()
56
- {
57
- log ( *this );
58
- }
59
-
54
+
60
55
template < typename TypeOfSomething >
61
56
log_record& write ( TypeOfSomething&& something )
62
57
{
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(custom_log_handler_output) {
28
28
const auto message = " At line " + std::to_string (line_num) + " we check the code." ;
29
29
30
30
set_log_record_handler ( custom_log_handler );
31
- log_record ( file_name, line_num ) << " At line " << line_num << " we check the code." ;
31
+ log ( log_record ( file_name, line_num ) << " At line " << line_num << " we check the code." ) ;
32
32
33
33
const auto result_output = log_output.str ();
34
34
Original file line number Diff line number Diff line change 10
10
#include < boost/test/unit_test.hpp>
11
11
12
12
#include < network/logging/logging.hpp>
13
+ #define NETWORK_ENABLE_LOGGING
14
+ #include < network/detail/debug.hpp>
13
15
14
16
using namespace network ::logging;
15
17
@@ -68,4 +70,9 @@ BOOST_AUTO_TEST_CASE(text_stream) {
68
70
69
71
BOOST_AUTO_TEST_CASE (raw_log) {
70
72
log ( " This is a raw log." );
73
+ }
74
+
75
+ BOOST_AUTO_TEST_CASE (macro_log) {
76
+ NETWORK_MESSAGE ( " This is a log through the macro." );
77
+ NETWORK_MESSAGE ( " This is a log through the macro, with a stream! Num=" << 42 << " - OK!" );
71
78
}
You can’t perform that action at this time.
0 commit comments