Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2008-02-03 13:12:34


Author: jtorjo
Date: 2008-02-03 13:12:34 EST (Sun, 03 Feb 2008)
New Revision: 43077
URL: http://svn.boost.org/trac/boost/changeset/43077

Log:
[logging]
v0.22.5, 3 feb 2008
- made mul_levels_mul_logers run successfully on Fedora8
Text files modified:
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 3 +
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 41 ++++++++++++++++++++++-----------------
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp | 10 ++++++++
   3 files changed, 34 insertions(+), 20 deletions(-)

Modified: sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp 2008-02-03 13:12:34 EST (Sun, 03 Feb 2008)
@@ -1,7 +1,8 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.22.4, 3 feb 2008
+@section changelog_cur_ver Current Version: v0.22.5, 3 feb 2008
+- made mul_levels_mul_logers run successfully on Fedora8
 - ts_posix.hpp - use BOOST_ASSERT instead of assert
 - solved bug in using_tags - delete_array used after logger destroyed
 - solved bug in no_levels_with_route - care about formatter::spacer

Modified: sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp
==============================================================================
--- sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp (original)
+++ sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp 2008-02-03 13:12:34 EST (Sun, 03 Feb 2008)
@@ -1,39 +1,44 @@
 
 
+
+#include <boost/logging/format_fwd.hpp>
+
 #include <boost/logging/format/named_write.hpp>
 typedef boost::logging::named_logger<>::type logger_type;
 
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg(), g_log_level(), debug ) << "[dbg] "
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
-BOOST_DEFINE_LOG_FILTER(g_log_level, boost::logging::level::holder )
-BOOST_DEFINE_LOG(g_log_dbg, logger_type)
+// Define the filters and loggers you'll use (usually in a source file)
+BOOST_DEFINE_LOG_FILTER(g_log_filter, boost::logging::filter::no_ts )
+BOOST_DEFINE_LOG(g_l, logger_type)
 
-using namespace boost::logging;
 
-void mul_levels_mul_logers_example() {
- // reuse the same destination for 2 logs
- destination::file out("out.txt");
- g_log_dbg()->writer().replace_destination("file", out);
- // formatting (first param) and destinations (second param)
- g_log_dbg()->writer().write("%time%($hh:$mm.$ss) |\n", "file cout debug");
- g_log_dbg()->mark_as_initialized();
+void one_logger_one_filter_example() {
+ // formatting : [idx] message \n
+ // destinations : console, file "out.txt" and debug window
+ g_l()->writer().write("[%idx%] |\n", "cout file(out.txt) debug");
+ g_l()->mark_as_initialized();
 
-
- // Step 8: use it...
     int i = 1;
- LDBG_ << "this is so cool " << i++;
+ L_ << "this is so cool " << i++;
+ L_ << "this is so cool again " << i++;
+
+ std::string hello = "hello", world = "world";
+ L_ << hello << ", " << world;
 
- g_log_level()->set_enabled(level::error);
- LDBG_ << "this will not be written anywhere";
+ g_log_filter()->set_enabled(false);
+ L_ << "this will not be written to the log";
+ L_ << "this won't be written to the log";
 
- g_log_level()->set_enabled(level::info);
+ g_log_filter()->set_enabled(true);
+ L_ << "good to be back ;) " << i++;
 }
 
 
 
 
 int main() {
- mul_levels_mul_logers_example();
+ one_logger_one_filter_example();
 }
 
 

Modified: sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp 2008-02-03 13:12:34 EST (Sun, 03 Feb 2008)
@@ -79,10 +79,18 @@
     g_log_app()->writer().replace_destination("file", out);
     g_log_dbg()->writer().replace_destination("file", out);
     // formatting (first param) and destinations (second param)
- g_log_err()->writer().write("[%idx%] %time%($hh:$mm.$ss) |\n", "file(err.txt)");
+ g_log_err()->writer().write("[%idx%] %time%($hh:$mm.$ss) |\n", "cout file(err.txt)"); // line A
     g_log_app()->writer().write("%time%($hh:$mm.$ss) |\n", "file cout");
     g_log_dbg()->writer().write("%time%($hh:$mm.$ss) |\n", "file cout debug");
 
+ /*
+ Note : the "line A" above originally was:
+ g_log_err()->writer().write("[%idx%] %time%($hh:$mm.$ss) |\n", "file(err.txt)");
+
+ This caused a very strange assertion failure on Fedora8, when the program exits, while destroying the global variables.
+ I've spent some time debugging it but to no avail. I will certainly look more into this.
+ */
+
     g_log_app()->mark_as_initialized();
     g_log_err()->mark_as_initialized();
     g_log_dbg()->mark_as_initialized();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk