Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2007-10-22 14:59:51


Author: jtorjo
Date: 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
New Revision: 40297
URL: http://svn.boost.org/trac/boost/changeset/40297

Log:
[logging]
v0.8.3, 22 oct 2007
- now have 8 scenarios
- updated documentation

Added:
   sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp (contents, props changed)
Text files modified:
   sandbox/logging/boost/logging/detail/raw_doc/fixme.hpp | 12 --
   sandbox/logging/boost/logging/detail/raw_doc/scenarios.hpp | 62 ++++++++++++++++++
   sandbox/logging/boost/logging/detail/raw_doc/scenarios_code.hpp | 41 ++++++++++++
   sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp | 5 +
   sandbox/logging/boost/logging/format/formatter/convert_format.hpp | 2
   sandbox/logging/boost/logging/macros.hpp | 1
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp | 90 +++++++++++++-------------
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp | 44 +++++++-----
   sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp | 8 +-
   sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.vcproj | 134 +++++++++++++++++++++++++++++++++++++++
   sandbox/logging/lib/logging/src/changelog.txt | 6 +
   11 files changed, 325 insertions(+), 80 deletions(-)

Modified: sandbox/logging/boost/logging/detail/raw_doc/fixme.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/fixme.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/fixme.hpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -2,21 +2,13 @@
 
 
 
-FIXME change the workflow & logger's definition - it doesn't need a filter, but it can have one!
+FIXME change the workflow & logger's definition - it doesn't need a filter
 
 
 
 
-scenarios:
-remaining scenarios
-- one logger; several levels - use a sink (that is, see how we find "is_enabled")
- - we can simply use the level.is_enabled(xxx) question, and then write to the log
-- no levels
-- fastest , no <<
-- fastest , using <<
-- using your own formatters and destinations integrated
 
---> doxygen_web -> copy from doxygen, once all is done, and examples finally work
+--> post code on the net
 
 ------> FIXME after showing scenarios, show customizing?
 

Modified: sandbox/logging/boost/logging/detail/raw_doc/scenarios.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/scenarios.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/scenarios.hpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -6,9 +6,17 @@
 - @ref common_scenarios_1
 - @ref common_scenarios_2
 - @ref common_scenarios_3
+- @ref common_scenarios_4
+- @ref common_scenarios_5
+- @ref common_scenarios_6
+- @ref common_scenarios_7
+- @ref common_scenarios_8
 
 @copydoc common_usage_steps_fd
 
+
+
+\n\n\n
 @section common_scenarios_1 Scenario 1, Common usage: Multiple levels, One logging class, Multiple destinations.
 
 Scenario 1 should be the most common.
@@ -18,6 +26,8 @@
 @ref scenarios_code_1 "Click to see the code"
 \n\n\n
 
+
+
 @section common_scenarios_2 Scenario 2: Multiple levels, Multiple logging classes, Multiple destinations.
 
 @copydoc mul_levels_mul_logers
@@ -26,11 +36,63 @@
 \n\n\n
 
 
+
 @section common_scenarios_3 Scenario 3: No levels, One Logger, Multiple destinations, Custom route
 
 @copydoc no_levels_with_route
 
 @ref scenarios_code_3 "Click to see the code"
+\n\n\n
+
+
+
+@section common_scenarios_4 Scenario 4: No levels, Multiple Loggers, One Filter
+
+@copydoc mul_loggers_one_filter
+
+@ref scenarios_code_4 "Click to see the code"
+\n\n\n
+
+
+
+@section common_scenarios_5 Scenario 5: No levels, One Logger, One Filter
+
+@copydoc one_loger_one_filter
+
+@ref scenarios_code_5 "Click to see the code"
+\n\n\n
+
+
+
+@section common_scenarios_6 Scenario 6: Fastest: Multiple Loggers, One Filter, Not using Formatters/Destinations, Not using <<
+
+@copydoc fastest_no_ostr_like
+
+@ref scenarios_code_6 "Click to see the code"
+\n\n\n
+
+
+
+@section common_scenarios_7 Scenario 7: Fast: Multiple Loggers, One Filter, Not using Formatters/Destinations, Using <<
+
+@copydoc fastest_use_ostr_like
+
+@ref scenarios_code_7 "Click to see the code"
+\n\n\n
+
+
+
+@section common_scenarios_8 Scenario 8: Using custom formatters/destinations together with the existing formatters/destinations
+
+@copydoc custom_fmt_dest
+
+@ref scenarios_code_8 "Click to see the code"
+\n\n\n
+
+
+
+
+
 
 */
 

Modified: sandbox/logging/boost/logging/detail/raw_doc/scenarios_code.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/scenarios_code.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/scenarios_code.hpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -6,6 +6,11 @@
 - @ref scenarios_code_1
 - @ref scenarios_code_2
 - @ref scenarios_code_3
+- @ref scenarios_code_4
+- @ref scenarios_code_5
+- @ref scenarios_code_6
+- @ref scenarios_code_7
+- @ref scenarios_code_8
 
 
 \n\n\n
@@ -16,6 +21,7 @@
 
 
 
+
 @section scenarios_code_2 Scenario 2: Multiple levels, Multiple logging classes, Multiple destinations
 
 @include mul_levels_mul_logers.cpp
@@ -29,6 +35,41 @@
 \n\n\n
 
 
+
+@section scenarios_code_4 Scenario 4: No levels, Multiple Loggers, One Filter
+
+@include mul_loggers_one_filter.cpp
+\n\n\n
+
+
+
+@section scenarios_code_5 Scenario 5: No levels, One Logger, One Filter
+
+@include one_loger_one_filter.cpp
+\n\n\n
+
+
+
+@section scenarios_code_6 Scenario 6: Fastest: Multiple Loggers, One Filter, Not using Formatters/Destinations, Not using <<
+
+@include fastest_no_ostr_like.cpp
+\n\n\n
+
+
+
+@section scenarios_code_7 Scenario 7: Fast: Multiple Loggers, One Filter, Not using Formatters/Destinations, Using <<
+
+@include fastest_use_ostr_like.cpp
+\n\n\n
+
+
+
+@section scenarios_code_8 Scenario 8: Using custom formatters/destinations together with the existing formatters/destinations
+
+@include custom_fmt_dest.cpp
+\n\n\n
+
+
 */
 
 }}

Modified: sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -10,6 +10,11 @@
     - @ref common_scenarios_1
     - @ref common_scenarios_2
     - @ref common_scenarios_3
+ - @ref common_scenarios_4
+ - @ref common_scenarios_5
+ - @ref common_scenarios_6
+ - @ref common_scenarios_7
+ - @ref common_scenarios_8
 
 - @ref workflow
     - @ref workflow_introduction

Modified: sandbox/logging/boost/logging/format/formatter/convert_format.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/formatter/convert_format.hpp (original)
+++ sandbox/logging/boost/logging/format/formatter/convert_format.hpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -51,7 +51,7 @@
     */
     namespace prepend {
         void write(const char_type * src, string_type & dest ) {
- const char * end = src;
+ const char_type * end = src;
             for ( ; *end; ++end);
             dest.insert( dest.begin(), src, end);
         }

Modified: sandbox/logging/boost/logging/macros.hpp
==============================================================================
--- sandbox/logging/boost/logging/macros.hpp (original)
+++ sandbox/logging/boost/logging/macros.hpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -122,6 +122,7 @@
 
 #define BOOST_LOG_USE_LOG_IF_FILTER(l, the_filter) BOOST_LOG_USE_LOG(l, read_msg().gather().out(), the_filter)
 
+#define BOOST_LOG_USE_SIMPLE_LOG_IF_FILTER(l, is_log_enabled) if ( !(is_log_enabled) ) ; else l ->operator()
 
 
 

Added: sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -0,0 +1,176 @@
+// custom_fmt_dest.cpp
+//
+// This example shows you how easy it is to add your custom formatter /destination classes.
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+/**
+@example custom_fmt_dest.cpp
+
+@copydoc custom_fmt_dest
+
+@page custom_fmt_dest custom_fmt_dest.cpp Example
+
+This example shows you how easy it is to add your custom formatter /destination classes.
+
+This usage:
+- You have one logger
+- You have one filter, which can be turned on or off
+- You want to format the message before it's written
+- The logger has several log destinations
+ - The output goes to console, debug output window, and a file called out.txt - as XML
+ - Formatting - prefix each message by its start time, its index, and append enter
+
+\n\n
+Custom classes:
+- secs_since_start - custom formatter
+- as_xml - custom destination
+
+
+\n\n
+Optimizations:
+- use a cache string (from optimize namespace), in order to make formatting the message faster
+
+
+\n\n
+The output will look similar to this one:
+
+
+The console and the debug window will be the same:
+@code
++6s [1] this is so cool 1
++6s [2] this is so cool again 2
++7s [3] hello, world
++7s [4] good to be back ;) 3
+@endcode
+
+
+The out.txt file will look like this:
+
+
+@code
+<msg>+6s [1] this is so cool 1
+</msg>
+<msg>+6s [2] this is so cool again 2
+</msg>
+<msg>+7s [3] hello, world
+</msg>
+<msg>+7s [4] good to be back ;) 3
+</msg>
+@endcode
+
+*/
+
+
+
+#define BOOST_LOGGING_COMPILE_FAST_OFF
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format.hpp>
+
+using namespace boost::logging;
+
+// Optimize : use a cache string, to make formatting the message faster
+typedef optimize::cache_string_one_str<> cache_string;
+
+// Step 1: specify your formatter & destination base classes
+typedef formatter::base< cache_string& > formatter_base;
+typedef destination::base< const std::string & > destination_base;
+
+// Step 2 : Define your logging class(es)
+typedef logger< use_format_write<formatter_base,destination_base> > log_type;
+
+// Step 3 : Set up a filter
+filter::no_ts g_log_filter ;
+
+// Step 4: declare which loggers you'll use
+BOOST_DECLARE_LOG(g_l, log_type) // normally these go into a header file ;)
+
+// Step 5: define which loggers you'll use
+BOOST_DEFINE_LOG(g_l, log_type)
+
+// Step 6: define the macros through which you'll log
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter.is_enabled() )
+
+// Example of custom formatter:
+// dump the no. of seconds since start of program
+struct secs_since_start : formatter::class_<secs_since_start, formatter_base, formatter::implement_op_equal::no_context> {
+ ::time_t m_start;
+ secs_since_start() : m_start( ::time(0) ) {}
+ void operator()(param str) const {
+ ::time_t now = ::time(0);
+ std::stringstream out;
+ out << "+" << (int)(now-m_start) << "s ";
+ str.prepend_string( out.str() );
+ }
+};
+
+// Example of custom destination:
+// Dump each message as XML
+struct as_xml :
+ destination::class_<as_xml, destination_base, formatter::implement_op_equal::has_context>,
+ formatter::non_const_context<std::ofstream> {
+
+ std::string m_name;
+ as_xml(const char* name) : non_const_context_base(name), m_name(name) {}
+ void operator()(param str) const {
+ context() << "<msg>" << str << "</msg>" << std::endl;
+ }
+
+ bool operator==(const as_xml& other) const { return m_name == other.m_name; }
+};
+
+
+void custom_fmt_dest_example() {
+ // Step 7: add formatters and destinations
+ // That is, how the message is to be formatted and where should it be written to
+
+ g_l->writer().add_formatter( formatter::idx() );
+ g_l->writer().add_formatter( formatter::append_enter() );
+ g_l->writer().add_formatter( secs_since_start() );
+
+ g_l->writer().add_destination( destination::cout() );
+ g_l->writer().add_destination( destination::dbg_window() );
+ g_l->writer().add_destination( as_xml("out.txt") );
+
+ // Step 8: use it...
+ int i = 1;
+ L_ << "this is so cool " << i++;
+ L_ << "this is so cool again " << i++;
+
+ std::string hello = "hello", world = "world";
+ L_ << hello << ", " << world;
+
+ 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_filter.set_enabled(true);
+ L_ << "good to be back ;) " << i++;
+
+ // Step 9 : Enjoy!
+}
+
+
+
+#ifdef SINGLE_TEST
+
+int main() {
+ custom_fmt_dest_example();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -0,0 +1,108 @@
+// fastest_no_ostr_like.cpp
+//
+// Fastest. Does not use Formatters/Destinations. As logging syntax, uses the () operator
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+/**
+@example fastest_no_ostr_like.cpp
+
+@copydoc fastest_no_ostr_like
+
+@page fastest_no_ostr_like fastest_no_ostr_like.cpp Example
+
+
+This usage:
+- Fastest. It does not use formatters and destinations (thus,
+ the flexibility that comes with formatters/destinations) is gone
+- You have one filter, which can be turned on or off
+- You have 2 loggers: app and err.
+- The app writes to console, the err writes to "err.txt" file
+- the output is "dump" - no usage of << operator
+
+Here's what the output will be:
+
+The console:
+@code
+this is so cool
+hello, world
+good to be back ;)
+@endcode
+
+The err.txt file:
+@code
+first error
+second error
+@endcode
+
+
+*/
+
+
+
+#define BOOST_LOGGING_COMPILE_FAST_OFF
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format.hpp>
+
+using namespace boost::logging;
+
+
+// Step 1 : Define your logging class(es)
+typedef logger< destination::cout > app_log_type;
+typedef logger< destination::file > err_log_type;
+
+// Step 2 : Set up a filter
+filter::no_ts g_log_filter ;
+
+// Step 3: declare which loggers you'll use
+app_log_type g_log_app;
+err_log_type g_log_err("err.txt");
+
+// Step 4: define the macros through which you'll log
+#define LAPP_ BOOST_LOG_USE_SIMPLE_LOG_IF_FILTER(g_log_app, g_log_filter.is_enabled() )
+#define LERR_ BOOST_LOG_USE_SIMPLE_LOG_IF_FILTER(g_log_err, g_log_filter.is_enabled() )
+
+void fastest_no_ostr_like_example() {
+ // Step 5: use it...
+ LAPP_("this is so cool\n");
+ LERR_("first error \n");
+
+ std::string hello = "hello", world = "world";
+ LAPP_(hello + ", " + world + "\n");
+
+ g_log_filter.set_enabled(false);
+ LAPP_("this will not be written to the log");
+ LAPP_("this won't be written to the log");
+ LERR_("this error is not logged ");
+
+ g_log_filter.set_enabled(true);
+ LAPP_("good to be back ;) \n" );
+ LERR_("second error \n" );
+
+ // Step 6 : Enjoy!
+}
+
+
+
+#ifdef SINGLE_TEST
+
+int main() {
+ fastest_no_ostr_like_example();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -0,0 +1,111 @@
+// fastest_use_ostr_like.cpp
+//
+// Fastest. Does not use Formatters/Destinations. As logging syntax, uses the << operator
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+/**
+@example fastest_use_ostr_like.cpp
+
+@copydoc fastest_use_ostr_like
+
+@page fastest_use_ostr_like fastest_use_ostr_like.cpp Example
+
+
+This usage:
+- Fastest. It does not use formatters and destinations (thus,
+ the flexibility that comes with formatters/destinations) is gone
+- You have one filter, which can be turned on or off
+- You have 2 loggers: app and err.
+- The app writes to console, the err writes to "err.txt" file
+- It uses the << operator as the logging syntax
+
+Here's what the output will be:
+
+The console:
+@code
+this is so cool 1
+this is so cool again 2
+hello, world
+good to be back ;) 4
+@endcode
+
+The err.txt file:
+@code
+first error 3
+second error 5
+@endcode
+
+
+*/
+
+
+
+#define BOOST_LOGGING_COMPILE_FAST_OFF
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format.hpp>
+
+using namespace boost::logging;
+
+
+// Step 1 : Define your logging class(es)
+typedef logger< process_msg<gather::ostream_like::return_str<>, destination::cout> > app_log_type;
+typedef logger< process_msg<gather::ostream_like::return_str<>, destination::file> > err_log_type;
+
+// Step 2 : Set up a filter
+filter::no_ts g_log_filter ;
+
+// Step 3: declare which loggers you'll use
+app_log_type g_log_app;
+err_log_type g_log_err("err.txt");
+
+// Step 4: define the macros through which you'll log
+#define LAPP_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_app, g_log_filter.is_enabled() )
+#define LERR_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_err, g_log_filter.is_enabled() )
+
+void fastest_use_ostr_like_example() {
+ // Step 5: use it...
+ int i = 1;
+ LAPP_ << "this is so cool " << i++ << "\n";
+ LAPP_ << "this is so cool again " << i++ << "\n";
+ LERR_ << "first error " << i++ << "\n";
+
+ std::string hello = "hello", world = "world";
+ LAPP_ << hello << ", " << world << "\n";
+
+ g_log_filter.set_enabled(false);
+ LAPP_ << "this will not be written to the log";
+ LAPP_ << "this won't be written to the log";
+ LERR_ << "this error is not logged " << i++;
+
+ g_log_filter.set_enabled(true);
+ LAPP_ << "good to be back ;) " << i++ << "\n";
+ LERR_ << "second error " << i++ << "\n";
+
+ // Step 6 : Enjoy!
+}
+
+
+
+#ifdef SINGLE_TEST
+
+int main() {
+ fastest_use_ostr_like_example();
+}
+
+#endif
+
+// End of file
+

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 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -1,4 +1,4 @@
-// test_mul_levels_mul_logers.hpp
+// mul_levels_mul_logers.cpp
 //
 // A test of the Logging library with multiple levels and multiple logging classes (each writing to multiple destinations).
 
@@ -17,62 +17,62 @@
 
 
 /**
- @example mul_levels_mul_logers.cpp
+@example mul_levels_mul_logers.cpp
 
- @copydoc mul_levels_mul_logers
+@copydoc mul_levels_mul_logers
 
- @page mul_levels_mul_logers mul_levels_mul_logers.cpp Example
+@page mul_levels_mul_logers mul_levels_mul_logers.cpp Example
 
 
- This usage:
- - You have multiple levels (in this example: debug < info < error)
- - You want to format the message before it's written
- (in this example: prefix it by index, by time, and append an enter to it)
- - You have several loggers
- - Each logger has several log destinations
+This usage:
+- You have multiple levels (in this example: debug < info < error)
+- You want to format the message before it's written
+ (in this example: prefix it by index, by time, and append an enter to it)
+- You have several loggers
+- Each logger has several log destinations
 
- Optimizations:
- - use a cache string (from optimize namespace), in order to make formatting the message faster
+Optimizations:
+- use a cache string (from optimize namespace), in order to make formatting the message faster
 
- Logs:
- - Error messages go into err.txt file
- - formatting - prefix each message by time, index, and append enter
- - Info output goes to console, and a file called out.txt
- - formatting - prefix each message by "[app]", time, and append enter
- - Debug messages go to the debug output window, and a file called out.txt
- - formatting - prefix each message by "[dbg]", time, and append enter
+Logs:
+- Error messages go into err.txt file
+ - formatting - prefix each message by time, index, and append enter
+- Info output goes to console, and a file called out.txt
+ - formatting - prefix each message by "[app]", time, and append enter
+- Debug messages go to the debug output window, and a file called out.txt
+ - formatting - prefix each message by "[dbg]", time, and append enter
 
 
- Here's how the output will look like:
+Here's how the output will look like:
 
- The output window:
- @code
- 07:52.30 [dbg] this is so cool 1
- 07:52.30 [dbg] this is so cool again 2
- @endcode
+The debug output window:
+@code
+07:52.30 [dbg] this is so cool 1
+07:52.30 [dbg] this is so cool again 2
+@endcode
 
 
- The console:
- @code
- 07:52.30 [app] hello, world
- 07:52.30 [app] good to be back ;) 4
- @endcode
+The console:
+@code
+07:52.30 [app] hello, world
+07:52.30 [app] good to be back ;) 4
+@endcode
 
 
- The out.txt file:
- @code
- 07:52.30 [dbg] this is so cool 1
- 07:52.30 [dbg] this is so cool again 2
- 07:52.30 [app] hello, world
- 07:52.30 [app] good to be back ;) 4
- @endcode
+The out.txt file:
+@code
+07:52.30 [dbg] this is so cool 1
+07:52.30 [dbg] this is so cool again 2
+07:52.30 [app] hello, world
+07:52.30 [app] good to be back ;) 4
+@endcode
 
 
- The err.txt file
- @code
- 07:52.30 [1] first error 3
- 07:52.30 [2] second error 5
- @endcode
+The err.txt file
+@code
+07:52.30 [1] first error 3
+07:52.30 [2] second error 5
+@endcode
 */
 
 
@@ -111,7 +111,7 @@
 #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] "
 
-void test_mul_levels_one_logger() {
+void mul_levels_mul_logers_example() {
     // Step 7: add formatters and destinations
     // That is, how the message is to be formatted and where should it be written to
 
@@ -128,7 +128,7 @@
     g_log_app->writer().add_destination( out );
     g_log_app->writer().add_destination( destination::cout() );
 
- // Inf log
+ // Debug log
     g_log_dbg->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
     g_log_dbg->writer().add_formatter( formatter::append_enter() );
     g_log_dbg->writer().add_destination( out );
@@ -159,7 +159,7 @@
 #ifdef SINGLE_TEST
 
 int main() {
- test_mul_levels_one_logger();
+ mul_levels_mul_logers_example();
 }
 
 #endif

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 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -1,4 +1,4 @@
-// test_mul_levels_one_logger.hpp
+// mul_levels_one_logger.cpp
 //
 // A test of the Logging library with multiple levels and one logging class writing to multiple destinations.
 
@@ -17,27 +17,30 @@
 
 
 /**
- @example mul_levels_one_logger.cpp
+@example mul_levels_one_logger.cpp
 
- @copydoc mul_levels_one_logger
+@copydoc mul_levels_one_logger
 
- @page mul_levels_one_logger mul_levels_one_logger.cpp Example
+@page mul_levels_one_logger mul_levels_one_logger.cpp Example
 
- This usage:
- - You have multiple levels (in this example: debug < info < error)
- - You want to format the message before it's written
- (in this example: prefix it by index, by time, and append an enter to it)
- - You have <b>one log</b>, which writes to several log destinations
- (in this example: the console, the debug output window, and a file)
-
- In this example, all output will be written to the console, debug window, and "out.txt" file.
- It will look similar to this one:
-
- @code
- 12:59.27 [1] this is so cool 1
- 12:59.27 [2] hello, world
- 12:59.27 [3] good to be back ;) 2
- @endcode
+This usage:
+- You have multiple levels (in this example: debug < info < error)
+- You want to format the message before it's written
+ (in this example: prefix it by index, by time, and append an enter to it)
+- You have <b>one log</b>, which writes to several log destinations
+ (in this example: the console, the debug output window, and a file)
+
+In this example, all output will be written to the console, debug output window, and "out.txt" file.
+It will look similar to this one:
+
+@code
+21:03.17 [1] this is so cool 1
+21:03.17 [2] first error 2
+21:03.17 [3] hello, world
+21:03.17 [4] second error 3
+21:03.17 [5] good to be back ;) 4
+21:03.17 [6] third error 5
+@endcode
 
 */
 
@@ -85,6 +88,7 @@
     // Step 8: use it...
     int i = 1;
     LDBG_ << "this is so cool " << i++;
+ LERR_ << "first error " << i++;
 
     std::string hello = "hello", world = "world";
     LAPP_ << hello << ", " << world;
@@ -92,9 +96,11 @@
     g_log_level.set_enabled(level::error);
     LDBG_ << "this will not be written anywhere";
     LAPP_ << "this won't be written anywhere either";
+ LERR_ << "second error " << i++;
 
     g_log_level.set_enabled(level::info);
     LAPP_ << "good to be back ;) " << i++;
+ LERR_ << "third error " << i++;
 
     // Step 9 : Enjoy!
 }

Added: sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -0,0 +1,167 @@
+// mul_loggers_one_filter.cpp
+//
+// A test of the Logging library with multiple levels, multiple logging classes (each writing to multiple destinations) and one filter.
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+/**
+@example mul_loggers_one_filter.cpp
+
+@copydoc mul_loggers_one_filter
+
+@page mul_loggers_one_filter mul_loggers_one_filter.cpp Example
+
+
+This usage:
+- You have several loggers
+- You have one filter, which can be turned on or off
+- You want to format the message before it's written
+- Each logger has several log destinations
+
+Optimizations:
+- use a cache string (from optimize namespace), in order to make formatting the message faster
+
+Logs:
+- Error messages go into err.txt file
+ - formatting - prefix each message by time, index, and append enter
+- Info output goes to console, and a file called out.txt
+ - formatting - prefix each message by time, "[app]", and append enter
+- Debug messages go to the debug output window, and the console
+ - formatting - prefix each message by "[dbg]", time, and append enter
+
+
+Here's how the output will look like:
+
+The debug output window:
+@code
+18:59.24 [dbg] this is so cool 1
+18:59.24 [dbg] this is so cool again 2
+@endcode
+
+
+The console:
+@code
+18:59.24 [dbg] this is so cool 1
+18:59.24 [dbg] this is so cool again 2
+18:59.24 [app] hello, world
+18:59.24 [app] good to be back ;) 4
+@endcode
+
+
+The out.txt file:
+@code
+18:59.24 [app] hello, world
+18:59.24 [app] good to be back ;) 4
+@endcode
+
+
+The err.txt file
+@code
+18:59.24 [1] first error 3
+18:59.24 [2] second error 5
+@endcode
+*/
+
+
+
+#define BOOST_LOGGING_COMPILE_FAST_OFF
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format.hpp>
+
+using namespace boost::logging;
+
+// Optimize : use a cache string, to make formatting the message faster
+typedef optimize::cache_string_one_str<> cache_string;
+
+// Step 1: specify your formatter & destination base classes
+typedef formatter::base< cache_string& > formatter_base;
+typedef destination::base< const std::string & > destination_base;
+
+// Step 2 : Define your logging class(es)
+typedef logger< use_format_write<formatter_base,destination_base> > log_type;
+
+// Step 3 : Set up a filter
+filter::no_ts g_log_filter ;
+
+// Step 4: declare which loggers you'll use
+BOOST_DECLARE_LOG(g_log_err, log_type) // normally these go into a header file ;)
+BOOST_DECLARE_LOG(g_log_app, log_type)
+BOOST_DECLARE_LOG(g_log_dbg, log_type)
+
+// Step 5: define which loggers you'll use
+BOOST_DEFINE_LOG(g_log_err, log_type)
+BOOST_DEFINE_LOG(g_log_app, log_type)
+BOOST_DEFINE_LOG(g_log_dbg, log_type)
+
+// Step 6: define the macros through which you'll log
+#define LDBG_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_dbg, g_log_filter.is_enabled() ) << "[dbg] "
+#define LERR_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_err, g_log_filter.is_enabled() )
+#define LAPP_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_app, g_log_filter.is_enabled() ) << "[app] "
+
+void mul_logger_one_filter_example() {
+ // Step 7: add formatters and destinations
+ // That is, how the message is to be formatted and where should it be written to
+
+ // Err log
+ g_log_err->writer().add_formatter( formatter::idx() );
+ g_log_err->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
+ g_log_err->writer().add_formatter( formatter::append_enter() );
+ g_log_err->writer().add_destination( destination::file("err.txt") );
+
+ // App log
+ g_log_app->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
+ g_log_app->writer().add_formatter( formatter::append_enter() );
+ g_log_app->writer().add_destination( destination::file("out.txt") );
+ g_log_app->writer().add_destination( destination::cout() );
+
+ // Debug log
+ g_log_dbg->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
+ g_log_dbg->writer().add_formatter( formatter::append_enter() );
+ g_log_dbg->writer().add_destination( destination::dbg_window() );
+ g_log_dbg->writer().add_destination( destination::cout() );
+
+ // Step 8: use it...
+ int i = 1;
+ LDBG_ << "this is so cool " << i++;
+ LDBG_ << "this is so cool again " << i++;
+ LERR_ << "first error " << i++;
+
+ std::string hello = "hello", world = "world";
+ LAPP_ << hello << ", " << world;
+
+ g_log_filter.set_enabled(false);
+ LDBG_ << "this will not be written anywhere";
+ LAPP_ << "this won't be written anywhere either";
+ LERR_ << "this error is not logged " << i++;
+
+ g_log_filter.set_enabled(true);
+ LAPP_ << "good to be back ;) " << i++;
+ LERR_ << "second error " << i++;
+
+ // Step 9 : Enjoy!
+}
+
+
+
+#ifdef SINGLE_TEST
+
+int main() {
+ mul_logger_one_filter_example();
+}
+
+#endif
+
+// End of file
+

Modified: sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -1,6 +1,6 @@
-// test_mul_levels_one_logger.hpp
+// no_levels_with_route.cpp
 //
-// A test of the Logging library with multiple levels and one logging class writing to multiple destinations.
+// A test of the Logging library with no levels and one logging class writing to multiple destinations, using a custom route.
 
 // Boost Logging library
 //
@@ -96,7 +96,7 @@
 // Step 6: define the macros through which you'll log
 #define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter.is_enabled() )
 
-void test_mul_levels_one_logger() {
+void no_levels_with_route_example() {
     // Step 7: add formatters and destinations
     // That is, how the message is to be formatted...
     g_l->writer().add_formatter( formatter::idx() );
@@ -149,7 +149,7 @@
 #ifdef SINGLE_TEST
 
 int main() {
- test_mul_levels_one_logger();
+ no_levels_with_route_example();
 }
 
 #endif

Added: sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -0,0 +1,119 @@
+// one_loger_one_filter.cpp
+//
+// A test of the Logging library with one logger and one filter
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+/**
+@example one_loger_one_filter.cpp
+
+@copydoc one_loger_one_filter
+
+@page one_loger_one_filter one_loger_one_filter.cpp Example
+
+
+This usage:
+- You have one logger
+- You have one filter, which can be turned on or off
+- You want to format the message before it's written
+- The logger has several log destinations
+ - The output goes to console, debug output window, and a file called out.txt
+ - Formatting - prefix each message by its index, and append enter
+
+Optimizations:
+- use a cache string (from optimize namespace), in order to make formatting the message faster
+
+In this example, all output will be written to the console, debug window, and "out.txt" file.
+It will be:
+
+@code
+[1] this is so cool 1
+[2] this is so cool again 2
+[3] hello, world
+[4] good to be back ;) 3
+@endcode
+
+*/
+
+
+
+#define BOOST_LOGGING_COMPILE_FAST_OFF
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format.hpp>
+
+using namespace boost::logging;
+
+// Optimize : use a cache string, to make formatting the message faster
+typedef optimize::cache_string_one_str<> cache_string;
+
+// Step 1: specify your formatter & destination base classes
+typedef formatter::base< cache_string& > formatter_base;
+typedef destination::base< const std::string & > destination_base;
+
+// Step 2 : Define your logging class(es)
+typedef logger< use_format_write<formatter_base,destination_base> > log_type;
+
+// Step 3 : Set up a filter
+filter::no_ts g_log_filter ;
+
+// Step 4: declare which loggers you'll use
+BOOST_DECLARE_LOG(g_l, log_type) // normally these go into a header file ;)
+
+// Step 5: define which loggers you'll use
+BOOST_DEFINE_LOG(g_l, log_type)
+
+// Step 6: define the macros through which you'll log
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter.is_enabled() )
+
+void one_logger_one_filter_example() {
+ // Step 7: add formatters and destinations
+ // That is, how the message is to be formatted and where should it be written to
+
+ g_l->writer().add_formatter( formatter::idx() );
+ g_l->writer().add_formatter( formatter::append_enter() );
+ g_l->writer().add_destination( destination::file("out.txt") );
+ g_l->writer().add_destination( destination::cout() );
+ g_l->writer().add_destination( destination::dbg_window() );
+
+ // Step 8: use it...
+ int i = 1;
+ L_ << "this is so cool " << i++;
+ L_ << "this is so cool again " << i++;
+
+ std::string hello = "hello", world = "world";
+ L_ << hello << ", " << world;
+
+ 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_filter.set_enabled(true);
+ L_ << "good to be back ;) " << i++;
+
+ // Step 9 : Enjoy!
+}
+
+
+
+#ifdef SINGLE_TEST
+
+int main() {
+ one_logger_one_filter_example();
+}
+
+#endif
+
+// End of file
+

Modified: sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.vcproj
==============================================================================
--- sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.vcproj (original)
+++ sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.vcproj 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -246,7 +246,7 @@
                         OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                         IntermediateDirectory="$(ConfigurationName)"
                         ConfigurationType="1"
- CharacterSet="1"
+ CharacterSet="2"
>
                         <Tool
                                 Name="VCPreBuildEventTool"
@@ -335,6 +335,14 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <File
                                 RelativePath="..\..\..\tests\format\test_manip_being_func.cpp"
@@ -347,6 +355,14 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <File
                                 RelativePath="..\..\..\tests\format\test_manip_w_msgroute.cpp"
@@ -359,6 +375,14 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <File
                                 RelativePath="..\..\..\tests\test_mul_lev_difflogs.cpp"
@@ -371,6 +395,14 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <File
                                 RelativePath="..\..\..\tests\test_mul_lev_samelog.cpp"
@@ -383,6 +415,14 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <File
                                 RelativePath="..\..\..\tests\test_multiple_simple_logs.cpp"
@@ -395,6 +435,14 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <File
                                 RelativePath="..\..\..\tests\test_ostream_like.cpp"
@@ -407,6 +455,14 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <File
                                 RelativePath="..\..\..\tests\test_simple_dump_to_cout.cpp"
@@ -419,6 +475,14 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <File
                                 RelativePath="..\..\..\tests\format\test_simple_formatter.cpp"
@@ -431,11 +495,55 @@
                                                 Name="VCCLCompilerTool"
                                         />
                                 </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                         <Filter
                                 Name="scenarios"
>
                                 <File
+ RelativePath="..\..\scenarios\custom_fmt_dest.cpp"
+ >
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\scenarios\fastest_no_ostr_like.cpp"
+ >
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\scenarios\fastest_use_ostr_like.cpp"
+ >
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
                                         RelativePath="..\..\scenarios\mul_levels_mul_logers.cpp"
>
                                         <FileConfiguration
@@ -452,6 +560,17 @@
>
                                         <FileConfiguration
                                                 Name="Test|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\scenarios\mul_loggers_one_filter.cpp"
+ >
+ <FileConfiguration
+ Name="Test|Win32"
                                                 ExcludedFromBuild="true"
>
                                                 <Tool
@@ -464,6 +583,19 @@
>
                                         <FileConfiguration
                                                 Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\scenarios\one_loger_one_filter.cpp"
+ >
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
>
                                                 <Tool
                                                         Name="VCCLCompilerTool"

Modified: sandbox/logging/lib/logging/src/changelog.txt
==============================================================================
--- sandbox/logging/lib/logging/src/changelog.txt (original)
+++ sandbox/logging/lib/logging/src/changelog.txt 2007-10-22 14:59:49 EDT (Mon, 22 Oct 2007)
@@ -1,4 +1,10 @@
 
+
+v0.8.3, 22 oct 2007
+- now have 8 scenarios
+- updated documentation
+
+
 v0.8.2, 22 oct 2007
 - added one more common scenario (with_route)
 


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