Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2008-01-26 01:13:48


Author: jtorjo
Date: 2008-01-26 01:13:47 EST (Sat, 26 Jan 2008)
New Revision: 42981
URL: http://svn.boost.org/trac/boost/changeset/42981

Log:
[logging]
v0.21.4, 26 jan 2008
- added BOOST_LOG_DONOT_USE_WCHAR_T for Windows users

Text files modified:
   sandbox/logging/boost/logging/defaults.hpp | 2
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 3
   sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp | 2
   sandbox/logging/boost/logging/tags.hpp | 2
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 4
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 83 +++++++++------------------------------
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp | 3
   sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp | 2
   8 files changed, 30 insertions(+), 71 deletions(-)

Modified: sandbox/logging/boost/logging/defaults.hpp
==============================================================================
--- sandbox/logging/boost/logging/defaults.hpp (original)
+++ sandbox/logging/boost/logging/defaults.hpp 2008-01-26 01:13:47 EST (Sat, 26 Jan 2008)
@@ -65,7 +65,7 @@
 
 // define BOOST_LOG_USE_WCHAR_T if you want your char type to be 'wchar_t'
 
-#ifdef BOOST_WINDOWS
+#if defined(BOOST_WINDOWS) && !defined(BOOST_LOG_DONOT_USE_WCHAR_T)
 #if defined( UNICODE) || defined(_UNICODE)
 #undef BOOST_LOG_USE_WCHAR_T
 #define BOOST_LOG_USE_WCHAR_T

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-01-26 01:13:47 EST (Sat, 26 Jan 2008)
@@ -1,7 +1,8 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.21.3, 24 jan 2008
+@section changelog_cur_ver Current Version: v0.21.4, 26 jan 2008
+- added BOOST_LOG_DONOT_USE_WCHAR_T for Windows users
 - added more docs to named_logger
 - added named_logger - much easier to use the logging lib - doesn't require any advanced knowledge at all
 - simplified examples, removed some of them from the "Scenarios" page; they're still found in the "Examples" section in the docs

Modified: sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp 2008-01-26 01:13:47 EST (Sat, 26 Jan 2008)
@@ -20,7 +20,7 @@
 
 - just <tt>\#define BOOST_LOG_USE_WCHAR_T</tt> before including any Boost.Logging files
 - For Windows, in case the @c UNICODE or @c _UNICODE is defined, the @c BOOST_LOG_USE_WCHAR_T is defined automatically for you
-
+ - If you don't wish that, please <tt>#define BOOST_LOG_DONOT_USE_WCHAR_T</tt> globally, before including any Boost Log files.
 
 
 */

Modified: sandbox/logging/boost/logging/tags.hpp
==============================================================================
--- sandbox/logging/boost/logging/tags.hpp (original)
+++ sandbox/logging/boost/logging/tags.hpp 2008-01-26 01:13:47 EST (Sat, 26 Jan 2008)
@@ -104,7 +104,7 @@
 @section tag_explained Tags - explained
 
 @code
-#include <boost/logging/tags.hpp>
+#include <boost/logging/format_fwd.hpp>
 @endcode
 
 

Modified: sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj
==============================================================================
--- sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj (original)
+++ sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj 2008-01-26 01:13:47 EST (Sat, 26 Jan 2008)
@@ -170,7 +170,7 @@
                         OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                         IntermediateDirectory="$(ConfigurationName)"
                         ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
>
                         <Tool
                                 Name="VCPreBuildEventTool"
@@ -330,7 +330,6 @@
>
                                 <FileConfiguration
                                         Name="Test|Win32"
- ExcludedFromBuild="true"
>
                                         <Tool
                                                 Name="VCCLCompilerTool"
@@ -938,6 +937,7 @@
>
                                 <FileConfiguration
                                         Name="Test|Win32"
+ ExcludedFromBuild="true"
>
                                         <Tool
                                                 Name="VCCLCompilerTool"

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-01-26 01:13:47 EST (Sat, 26 Jan 2008)
@@ -1,88 +1,43 @@
 
 
-
 #include <boost/logging/format_fwd.hpp>
-#include <boost/logging/format/named_writer.hpp>
 
-// Step 3 : Specify your logging class(es)
+#include <boost/logging/format/named_writer.hpp>
 typedef boost::logging::named_logger<>::type logger_type;
 
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
-// Step 4: declare which filters and loggers you'll use (usually in a header file)
-BOOST_DECLARE_LOG_FILTER(g_log_level, boost::logging::level::holder ) // holds the application log level
-BOOST_DECLARE_LOG(g_log_err, logger_type)
-BOOST_DECLARE_LOG(g_log_app, logger_type)
-BOOST_DECLARE_LOG(g_log_dbg, logger_type)
-
-// Step 5: define the macros through which you'll log
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg(), g_log_level(), debug ) << "[dbg] "
-#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_err(), g_log_level(), error )
-#define LAPP_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_app(), g_log_level(), info ) << "[app] "
-
-
-// Step 6: Define the filters and loggers you'll use (usually in a source file)
-BOOST_DEFINE_LOG_FILTER(g_log_level, boost::logging::level::holder )
-BOOST_DEFINE_LOG(g_log_err, logger_type)
-BOOST_DEFINE_LOG(g_log_app, logger_type)
-BOOST_DEFINE_LOG(g_log_dbg, 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_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_app()->writer().write("[%idx%] %time%($hh:$mm.$ss) |\n", "file cout");
- g_log_dbg()->writer().write("[%idx%] %time%($hh:$mm.$ss) |\n", "file cout debug");
-
- g_log_app()->mark_as_initialized();
- g_log_err()->mark_as_initialized();
- g_log_dbg()->mark_as_initialized();
-
-
+// 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)
 
 
+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();
 
-
-
-
-
- g_log_err()->writer().write("%idx%/ [%time%($mm.$ss.$mili)] |\n", "file(err.txt)");
- g_log_app()->writer().write("%idx%/ [%time%($mm.$ss.$mili)] |\n", "file cout");
- g_log_dbg()->writer().write("%idx%/ [%time%($mm.$ss.$mili)] |\n", "file cout debug");
-
-
-
-
-
- // Step 8: use it...
     int i = 1;
- LDBG_ << "this is so cool " << i++;
- LDBG_ << "this is so cool again " << i++;
- LERR_ << "first error " << i++;
+ L_ << "this is so cool " << i++;
+ L_ << "this is so cool again " << i++;
 
     std::string hello = "hello", world = "world";
- LAPP_ << hello << ", " << world;
-
- g_log_level()->set_enabled(level::error);
- LDBG_ << "this will not be written anywhere";
- LAPP_ << "this won't be written anywhere either";
+ L_ << hello << ", " << world;
 
- g_log_level()->set_enabled(level::info);
- LAPP_ << "good to be back ;) " << i++;
- LERR_ << "second error " << i++;
+ g_log_filter()->set_enabled(false);
+ L_ << "this will not be written to the log";
+ L_ << "this won't be written to the log";
 
- // Step 9 : Enjoy!
+ 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_one_logger.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp 2008-01-26 01:13:47 EST (Sat, 26 Jan 2008)
@@ -36,7 +36,8 @@
 BOOST_DEFINE_LOG(g_l, logger_type)
 
 void test_mul_levels_one_logger() {
- // formatting (first param) and destinations (second param)
+ // formatting : time [idx] message \n
+ // destinations : console, file "out.txt" and debug window
     g_l()->writer().write("%time%($hh:$mm.$ss.$mili) [%idx%] |\n", "cout file(out.txt) debug");
     g_l()->mark_as_initialized();
 

Modified: sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp 2008-01-26 01:13:47 EST (Sat, 26 Jan 2008)
@@ -44,6 +44,8 @@
 
 
 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();
 


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