Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1bdbb5f

Browse files
committed
Merge pull request#171 from Klaim/master
log_record now don't log on destruction, logging macro will.
2 parentsb2be660 +d880bd0 commit1bdbb5f

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

‎include/network/detail/debug.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include<network/logging/logging.hpp>
2525
#ifndef NETWORK_MESSAGE
26-
#defineNETWORK_MESSAGE(msg) network::logging::log_record( __FILE__, __LINE__ ) << msg;
26+
#defineNETWORK_MESSAGE(msg){network::logging::log(network::logging::log_record( __FILE__, __LINE__ ) << msg ); }
2727
#endif
2828

2929
#else

‎include/network/logging/logging.hpp‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ class log_record
5151
, m_line( line )
5252
{
5353
}
54-
55-
~log_record()
56-
{
57-
log( *this );
58-
}
59-
54+
6055
template<typename TypeOfSomething >
6156
log_record&write( TypeOfSomething&& something )
6257
{

‎libs/network/test/logging/logging_custom_handler.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(custom_log_handler_output) {
2828
constauto message ="At line" +std::to_string(line_num) +" we check the code.";
2929

3030
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." );
3232

3333
constauto result_output = log_output.str();
3434

‎libs/network/test/logging/logging_log_record.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include<boost/test/unit_test.hpp>
1111

1212
#include<network/logging/logging.hpp>
13+
#defineNETWORK_ENABLE_LOGGING
14+
#include<network/detail/debug.hpp>
1315

1416
usingnamespacenetwork::logging;
1517

@@ -68,4 +70,9 @@ BOOST_AUTO_TEST_CASE(text_stream) {
6870

6971
BOOST_AUTO_TEST_CASE(raw_log) {
7072
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!" );
7178
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp