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

log_record now don't log on destruction, logging macro will.#171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deanberris merged 1 commit intocpp-netlib:masterfromKlaim:master
Nov 22, 2012
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletioninclude/network/detail/debug.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@

# include <network/logging/logging.hpp>
# ifndef NETWORK_MESSAGE
# define NETWORK_MESSAGE(msg) network::logging::log_record( __FILE__, __LINE__ ) << msg;
# define NETWORK_MESSAGE(msg){network::logging::log( network::logging::log_record( __FILE__, __LINE__ ) << msg ); }
# endif

#else
Expand Down
7 changes: 1 addition & 6 deletionsinclude/network/logging/logging.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,12 +51,7 @@ class log_record
, m_line( line )
{
}

~log_record()
{
log( *this );
}


template< typename TypeOfSomething >
log_record& write( TypeOfSomething&& something )
{
Expand Down
2 changes: 1 addition & 1 deletionlibs/network/test/logging/logging_custom_handler.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(custom_log_handler_output) {
const auto message = "At line " + std::to_string(line_num) + " we check the code.";

set_log_record_handler( custom_log_handler );
log_record( file_name, line_num ) << "At line " << line_num << " we check the code.";
log(log_record( file_name, line_num ) << "At line " << line_num << " we check the code." );

const auto result_output = log_output.str();

Expand Down
7 changes: 7 additions & 0 deletionslibs/network/test/logging/logging_log_record.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,8 @@
#include <boost/test/unit_test.hpp>

#include <network/logging/logging.hpp>
#define NETWORK_ENABLE_LOGGING
#include <network/detail/debug.hpp>

using namespace network::logging;

Expand DownExpand Up@@ -68,4 +70,9 @@ BOOST_AUTO_TEST_CASE(text_stream) {

BOOST_AUTO_TEST_CASE(raw_log) {
log( "This is a raw log." );
}

BOOST_AUTO_TEST_CASE(macro_log) {
NETWORK_MESSAGE( "This is a log through the macro." );
NETWORK_MESSAGE( "This is a log through the macro, with a stream! Num=" << 42 << " - OK!" );
}

[8]ページ先頭

©2009-2025 Movatter.jp