$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: john.groups_at_[hidden]
Date: 2008-02-01 10:55:33
Author: jtorjo
Date: 2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
New Revision: 43047
URL: http://svn.boost.org/trac/boost/changeset/43047
Log:
[logging]
v0.21.11, 1 feb 2008
- fixed scoped logs and added test for them
Added:
   sandbox/logging/lib/logging/tests/test_scoped_log/
   sandbox/logging/lib/logging/tests/test_scoped_log/test.cpp   (contents, props changed)
   sandbox/logging/lib/logging/tests/test_scoped_log/test_scoped_log.vcproj   (contents, props changed)
Text files modified: 
   sandbox/logging/boost/logging/detail/cache_before_init.hpp                   |     9 -                                       
   sandbox/logging/boost/logging/detail/logger.hpp                              |    15 ++                                      
   sandbox/logging/boost/logging/detail/raw_doc/defining_your_logger_filter.hpp |     4                                         
   sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp          |     1                                         
   sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp                |    12 ++                                      
   sandbox/logging/boost/logging/detail/raw_doc/scoped_logs.hpp                 |     8 +                                       
   sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp           |     1                                         
   sandbox/logging/boost/logging/detail/raw_doc/todo.hpp                        |     4                                         
   sandbox/logging/boost/logging/detail/scoped_log.hpp                          |    62 +++++++++--                             
   sandbox/logging/boost/logging/logging.hpp                                    |     1                                         
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp             |   211 ++++++++++++++++++++++++++------------- 
   sandbox/logging/lib/logging/tests/Jamfile.v2                                 |     1                                         
   sandbox/logging/lib/logging/tests/all_tests.sln                              |     8 +                                       
   13 files changed, 232 insertions(+), 105 deletions(-)
Modified: sandbox/logging/boost/logging/detail/cache_before_init.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/cache_before_init.hpp	(original)
+++ sandbox/logging/boost/logging/detail/cache_before_init.hpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -133,15 +133,6 @@
         }
     }
 
-    // called after all data has been gathered
-    template<class writer_type> void on_do_write(msg_type & msg, const writer_type & writer) const {
-        if ( is_cache_turned_off() )
-            writer(msg); 
-        else
-            add_msg(msg);
-    }
-
-protected:
     void add_msg(const msg_type & msg) const {
         mutex::scoped_lock lk(m_cs);
         // note : last_enabled can be null, if we don't want to use filters (BOOST_LOG_BEFORE_INIT_USE_LOG_ALL)
Modified: sandbox/logging/boost/logging/detail/logger.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/logger.hpp	(original)
+++ sandbox/logging/boost/logging/detail/logger.hpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -97,7 +97,10 @@
     public:
         // called after all data has been gathered
         void on_do_write(msg_type & msg) const {
-            cache().on_do_write( msg, call_do_write(*this) );
+            if ( logger_base_type::is_cache_turned_off() )
+                do_write(msg);
+            else
+                cache().add_msg(msg);
         }
 
         virtual void do_write(msg_type&) const = 0;
@@ -239,7 +242,10 @@
 
         // called after all data has been gathered
         void on_do_write(msg_type & msg) const {
-            cache().on_do_write( msg, writer() );
+            if ( logger_base_type::is_cache_turned_off() )
+                writer()(msg);
+            else
+                cache().add_msg(msg);
         }
     private:
         void init() {
@@ -290,7 +296,10 @@
 
         // called after all data has been gathered
         void on_do_write(msg_type & msg) const {
-            cache().on_do_write( msg, writer() );
+            if ( logger_base_type::is_cache_turned_off() )
+                writer()(msg);
+            else
+                cache().add_msg(msg);
         }
     private:
         write_msg *m_writer;
Modified: sandbox/logging/boost/logging/detail/raw_doc/defining_your_logger_filter.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/defining_your_logger_filter.hpp	(original)
+++ sandbox/logging/boost/logging/detail/raw_doc/defining_your_logger_filter.hpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -356,11 +356,11 @@
 L_ << hello << ", " << world;
 @endcode
 
-If fast compile is off, when using the logs, you'll need to know the full type of the logger (the definition of the logger class). 
+If fast compile is off, when using the logs, you'll need to know the full type of the logger (the definition of the logger class). \n
 When using formatters/destinations, this means <tt>\#include <boost/logging/format.hpp></tt>. Also, when logging a message,
 the code for doing the actual logging will be generated inline, this taking a bit of compilation time.
 
-From my experiments, with fast compiling on, you get about 30% faster compile times. If you'd like to share your results, please drop me an email.
+@ref macros_compile_time "More details here".
 
 In short, 
 
Modified: sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp	(original)
+++ sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -63,7 +63,6 @@
 - when using Formatters and Destinations
 
 @code
-// when defining logs and you don't log messages on a dedicated thread 
 #include <boost/logging/format.hpp>
 @endcode
 
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-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -23,6 +23,18 @@
   - If you don't wish that, please <tt>#define BOOST_LOG_DONOT_USE_WCHAR_T</tt> globally, before including any Boost Logging Lib files.
 
 
+
+@section misc_compilers Compilers it's been tested on
+
+The Boost Logging Lib has been tested with the following compilers:
+
+- VC 2005 
+- VC 2003
+- gcc 3.4.2
+- gcc 4.1
+
+
+
 */
 
 }}
Modified: sandbox/logging/boost/logging/detail/raw_doc/scoped_logs.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/scoped_logs.hpp	(original)
+++ sandbox/logging/boost/logging/detail/raw_doc/scoped_logs.hpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -81,11 +81,15 @@
 @endcode
 
 Things you should know:
-- You can only use @c BOOST_SCOPED_LOG_CTX, if your loggers use << to @ref workflow_2a "gather the message"
 - When using @c BOOST_SCOPED_LOG_CTX, you pass as parameter, one of the @ref macros_use "macros" you've already defined.
+- When using @c BOOST_SCOPED_LOG_CTX, you'll always @em have to use @c << to write the message, even though
+  your logger might use a different syntax (see @ref workflow_2a "gathering the message")
 - When you use this macro (BOOST_SCOPED_LOG_CTX), a temporary variable is created, which will hold the result
-  of gathering your context. In the above case, this variable will contain the contents of:
+  of gathering your context. In the above case, this variable will contain the contents of: \n
   <tt> "func(" << a << ", str=" << str << ")"; </tt>
+- @c BOOST_SCOPED_LOG_CTX preserves the "is_enabled" policy of the underlying logger. In other words, if you do \n
+  <tt> BOOST_SCOPED_LOG_CTX(LDBG) << "func" << some_time_consuming_func(); </tt> \n
+  and the logger is disabled, the @c some_time_consuming_func() will not be called
 
 
 
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	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -12,6 +12,7 @@
     - @ref acknowledgements
     - @ref breaking_changes
       - @ref breaking_change_v_20
+    - @ref misc_compilers 
 
 
 - @ref workflow
Modified: sandbox/logging/boost/logging/detail/raw_doc/todo.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/todo.hpp	(original)
+++ sandbox/logging/boost/logging/detail/raw_doc/todo.hpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -22,6 +22,7 @@
 
 @section todo_implementation Implementation
 
+
 - @c normal         destination::stream_ptr - just like stream, but hold the stream as a shared pointer. Thus , we won't have to worry
                     about outliving the stream.
 
@@ -175,6 +176,9 @@
 
 - @c normal         "Manipulating thy manipulator" - another way is to create another manipulator, delete the current one , and add the new one
                     i should explain that this could not work immediately because of caching.
+
+- @c normal         scoped logs - scoped_write_msg - explain that you need to implement this in case you have your own gather.read_msg().out() class
+
 */
 
 }}
Modified: sandbox/logging/boost/logging/detail/scoped_log.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/scoped_log.hpp	(original)
+++ sandbox/logging/boost/logging/detail/scoped_log.hpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -23,6 +23,7 @@
 
 #include <boost/logging/detail/fwd.hpp>
 #include <algorithm>
+#include <iosfwd>
 
 namespace boost { namespace logging {
 
@@ -49,29 +50,62 @@
 
 #endif
 
+// default scoped write - in case your gather class .read_msg().out() returns an STL ostream
+template<class char_type, class char_traits> inline void scoped_write_msg(const hold_string_type & str, std::basic_ostream<char_type, char_traits> & out) {
+    out << str;
+}
 
 namespace detail {
-    template<class writer> struct scoped_writer {
-        scoped_writer(const writer & w) : m_w( w ) {}
-        template<class msg_type> void operator()(msg_type & msg) const {
-            m_w.gather_msg(msg);
+
+    template<class gather_msg = default_> struct scoped_gather_base {
+        typedef typename detail::find_gather_if_default<gather_msg>::msg_type msg_type;
+        virtual void do_gather(const msg_type & ) = 0;
+    };
+
+    /** 
+        when doing scoped logging, we use this as a trick to find out if a logger is enabled.
+        That is, we want to do the overhead of gathering the message to happen only if logging is enabled
+    */
+    template<class ostream_type = std::basic_ostringstream<char_type> , class gather_msg = default_ > struct scoped_logger {
+
+        typedef scoped_gather_base<gather_msg> scoped_gather;
+        scoped_logger(scoped_gather & do_gather) : m_gather(do_gather) {}
+        scoped_logger(const scoped_logger & other) : m_out( other.m_out.str() ), m_gather( other.m_gather) {}
+
+        template<class type> scoped_logger & operator<<(const type& val) {
+            m_out << val;
+            return *this;
+        }
+
+        // when we enter here, we know the logger is enabled
+        hold_string_type gathered_info() {
+            hold_string_type str = m_out.str();
+            m_gather.do_gather(str);
+            return BOOST_LOG_STR("start of ") + str;
         }
+
     private:
-        const writer &m_w;
+        ostream_type m_out;
+        scoped_gather & m_gather;
     };
+
+    template<class gather_type, class ostream_type> inline gather_type & operator,(gather_type & g, scoped_logger<ostream_type> & val) {
+        scoped_write_msg( val.gathered_info(), g);
+        return g;
+    }
 }
 
+
+
 #define BOOST_SCOPED_LOG_CTX_IMPL(logger_macro, operator_, class_name) \
-struct class_name { \
-    typedef ::boost::logging::hold_string_type string_type; \
-    class_name()  { } \
-    ~class_name() { logger_macro operator_ BOOST_LOG_STR("  end of ") operator_ m_str ; } \
-    void gather_msg(string_type & str) const { std::swap(m_str, str); logger_macro operator_ BOOST_LOG_STR("start of ") operator_ m_str ; } \
-    mutable string_type m_str; \
+struct class_name : ::boost::logging::detail::scoped_gather_base<> { \
+    class_name() : m_is_enabled(false) { } \
+    ~class_name() {  if ( m_is_enabled) logger_macro operator_ BOOST_LOG_STR("  end of ") operator_ m_str ; } \
+    void do_gather(const msg_type & str) { m_str = str; m_is_enabled = true; } \
+    msg_type m_str; \
+    bool m_is_enabled; \
 } BOOST_LOG_CONCATENATE(log_, __LINE__); \
-::boost::logging::logger< ::boost::logging::gather::ostream_like::return_str< ::boost::logging::hold_string_type > , ::boost::logging::detail::scoped_writer< class_name > > \
-    BOOST_LOG_CONCATENATE(scoped_log_val, __LINE__) ( BOOST_LOG_CONCATENATE(log_, __LINE__) ); \
-    BOOST_LOG_CONCATENATE(scoped_log_val, __LINE__) .read_msg().gather().out()
+    logger_macro , ::boost::logging::detail::scoped_logger<>( BOOST_LOG_CONCATENATE(log_, __LINE__) ) 
 
 
 
Modified: sandbox/logging/boost/logging/logging.hpp
==============================================================================
--- sandbox/logging/boost/logging/logging.hpp	(original)
+++ sandbox/logging/boost/logging/logging.hpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -28,6 +28,7 @@
 #include <boost/logging/detail/macros.hpp>
 #include <boost/logging/detail/tss/tss.hpp>
 #include <boost/logging/detail/level.hpp>
+#include <boost/logging/detail/scoped_log.hpp>
 
 // just in case we might think of using formatters
 #include <boost/logging/detail/format_msg_type.hpp>
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-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -1,95 +1,160 @@
+/**
+@example mul_loggers_one_filter.cpp
 
-/* 
-    Tests formatter::file
+@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 newline
+- Info output goes to console, and a file called out.txt
+  - formatting - prefix each message by time, "[app]", and append newline
+- Debug messages go to the debug output window, and the console
+  - formatting - prefix each message by "[dbg]", time, and append newline
+
+
+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
 */
-#include <boost/test/minimal.hpp>
+
+
 
 #include <boost/logging/format.hpp>
+
+#include <sstream>
 #include <string>
+BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
 
 using namespace boost::logging;
 
-typedef logger_format_write< > log_type;
+typedef logger_format_write< > logger_type;
 
-BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts ) 
-BOOST_DEFINE_LOG(g_l, log_type)
-
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) 
+BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts ) 
+BOOST_DECLARE_LOG(g_log_err, logger_type) 
+BOOST_DECLARE_LOG(g_log_app, logger_type)
+BOOST_DECLARE_LOG(g_log_dbg, logger_type)
+
+#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] "
 
+BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts ) 
+BOOST_DEFINE_LOG(g_log_err, logger_type)
+BOOST_DEFINE_LOG(g_log_app, logger_type)
+BOOST_DEFINE_LOG(g_log_dbg, logger_type)
+
+
+void f(int a, std::string str) {
+
+    BOOST_SCOPED_LOG_CTX(LDBG_) << "func(" << a << ", str=" << str << ")";
+
+#if 0
+    struct class_name : ::boost::logging::detail::scoped_gather_base<> { 
+    class_name() : m_is_enabled(false) { } 
+    ~class_name() { if ( m_is_enabled) LDBG_ << BOOST_LOG_STR("  end of ") << m_str ; } 
+    void do_gather(const msg_type & str) const { m_str = str; m_is_enabled = true; } 
+    mutable msg_type m_str; 
+    mutable bool m_is_enabled;
+} log_; 
+    LDBG_ , ::boost::logging::detail::scoped_logger<>(log_) << a << str_param;
+#endif
 
-void write_to_clean_file() {
-    // first, write to a clean file (that is, don't append to it)
-    g_l()->writer().add_destination( destination::file("out.txt", destination::file_settings().initial_overwrite(true) ));
-    g_l()->writer().add_formatter( formatter::append_newline_if_needed() );
-    g_l()->writer().add_destination( destination::cout() );
-    g_l()->turn_cache_off();
-
-    // read this .cpp file - every other line is logged (odd lines)
-    std::ifstream in("test.cpp");
-    bool enabled = true;
-    std::string line;
-    while ( std::getline(in, line) ) {
-        g_log_filter()->set_enabled(enabled);
-        L_ << "line odd " << line;
-        enabled = !enabled;
-    }
+    LDBG_ << "testing";
 }
 
-void append_to_file() {
-    // second, append to the same file
+void mul_logger_one_filter_example() {
+    // 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_newline() );
+    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_newline() );
+    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_newline() );
+    g_log_dbg()->writer().add_destination( destination::dbg_window() );
+    g_log_dbg()->writer().add_destination( destination::cout() );
+
+    g_log_app()->mark_as_initialized();
+    g_log_err()->mark_as_initialized();
+    g_log_dbg()->mark_as_initialized();
+
+    int i = 1;
+    LDBG_ << "this is so cool " << i++;
+    LDBG_ << "this is so cool again " << i++;
+    LERR_ << "first error " << i++;
+
+    f(1, "str");
+    g_log_filter()->set_enabled(false);
+    f(2, "str2");
+    g_log_filter()->set_enabled(true);
+    f(3, "str3");
+
+    std::string hello = "hello", world = "world";
+    LAPP_ << hello << ", " << world;
 
-    // ... first, remove old destination
-    g_l()->writer().del_destination( destination::file("out.txt"));
-    // ... now, re-add the same file - but now, for appending
-    g_l()->writer().add_destination( destination::file("out.txt", 
-        destination::file_settings().initial_overwrite(false).do_append(true) ));
-
-    // read this .cpp file - every other line is logged (even lines now)
-    std::ifstream in("test.cpp");
-    bool enabled = false;
-    std::string line;
-    while ( std::getline(in, line) ) {
-        g_log_filter()->set_enabled(enabled);
-        L_ << "line even " << line;
-        enabled = !enabled;
-    }
+    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_l()->writer().del_destination( destination::file("out.txt"));
     g_log_filter()->set_enabled(true);
-    L_ << "should not be written to file, only to console";
+    LAPP_ << "good to be back ;) " << i++;
+    LERR_ << "second error " << i++;
 }
 
-// now, see that what we've written was ok
-void test_write_ok() {
-    std::ifstream test("test.cpp");
-    std::ifstream out("out.txt");
-    std::string test_line, out_line;
-    // first, odd lines
-    while ( std::getline(test, test_line) ) {
-        std::getline(out, out_line);
-        BOOST_CHECK( "line odd " + test_line == out_line );
-        std::getline(test, test_line); // ignore even line
-    }
-
-    test.close();
-    std::ifstream test2("test.cpp");
-
-    // second, even lines
-    while ( std::getline(test2, test_line) && std::getline(test2, test_line) ) {
-        std::getline(out, out_line);
-        BOOST_CHECK( "line even " + test_line == out_line );
-    }
-
-    // out.txt - should have no more lines
-    std::getline(out, out_line);
-    BOOST_CHECK( out_line.empty() );
-}
 
 
-int test_main(int, char *[]) { 
-    write_to_clean_file();
-    append_to_file();
-    test_write_ok();
-    return 0;
+
+int main() {
+    mul_logger_one_filter_example();
 }
 
+
+// End of file
+
Modified: sandbox/logging/lib/logging/tests/Jamfile.v2
==============================================================================
--- sandbox/logging/lib/logging/tests/Jamfile.v2	(original)
+++ sandbox/logging/lib/logging/tests/Jamfile.v2	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -39,6 +39,7 @@
     [ run test_ts_resouce_with_cache/test_ts_resource.cpp ]
     [ run test_tss/test_tss.cpp test_tss/test_tss_objects.cpp test_tss/test_tss_on_end_delete.cpp : : : : test5 ]
     [ run test_on_ded_thread/test.cpp  : : : : test6 ]
+    [ run test_scoped_log/test.cpp  : : : : test7 ]
 #    [ run  ]
 #    [ run  ]
     ;
Modified: sandbox/logging/lib/logging/tests/all_tests.sln
==============================================================================
--- sandbox/logging/lib/logging/tests/all_tests.sln	(original)
+++ sandbox/logging/lib/logging/tests/all_tests.sln	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -17,7 +17,9 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_tss", "test_tss\test_tss.vcproj", "{4817A3DF-1CF9-4BF9-98AA-2CF5EE0E742F}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test_on_ded_thread\test_on_ded_thread.vcproj", "{C5897099-5FA2-4E12-AFFC-2015364347FA}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_on_dedicated_thread", "test_on_ded_thread\test_on_ded_thread.vcproj", "{C5897099-5FA2-4E12-AFFC-2015364347FA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_scoped_log", "test_scoped_log\test_scoped_log.vcproj", "{C9AD7E35-9BCE-48D5-AD4F-7BBDECF0DD30}"
 EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -61,6 +63,10 @@
                 {C5897099-5FA2-4E12-AFFC-2015364347FA}.Debug|Win32.Build.0 = Debug|Win32
                 {C5897099-5FA2-4E12-AFFC-2015364347FA}.Release|Win32.ActiveCfg = Release|Win32
                 {C5897099-5FA2-4E12-AFFC-2015364347FA}.Release|Win32.Build.0 = Release|Win32
+		{C9AD7E35-9BCE-48D5-AD4F-7BBDECF0DD30}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C9AD7E35-9BCE-48D5-AD4F-7BBDECF0DD30}.Debug|Win32.Build.0 = Debug|Win32
+		{C9AD7E35-9BCE-48D5-AD4F-7BBDECF0DD30}.Release|Win32.ActiveCfg = Release|Win32
+		{C9AD7E35-9BCE-48D5-AD4F-7BBDECF0DD30}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE
Added: sandbox/logging/lib/logging/tests/test_scoped_log/test.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_scoped_log/test.cpp	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -0,0 +1,47 @@
+/* 
+    Tests scoped_log
+*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/logging/format.hpp>
+#include <sstream>
+
+using namespace boost::logging;
+
+typedef logger_format_write< > log_type;
+
+BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts ) 
+BOOST_DEFINE_LOG(g_l, log_type)
+
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) 
+
+void scoped_func(int a, std::string str) {
+    BOOST_SCOPED_LOG_CTX(L_) << "func(" << a << ", str=" << str << ")";
+    L_ << "inner";
+}
+
+std::ostringstream g_out;
+int test_main(int, char *[]) { 
+    g_l()->writer().add_formatter( formatter::idx(), "[%] ");
+    g_l()->writer().add_formatter( formatter::append_newline() );
+    g_l()->writer().add_destination( destination::stream(g_out) );
+    g_l()->mark_as_initialized();
+
+    scoped_func(1, "str");
+    g_log_filter()->set_enabled(false);
+    scoped_func(2, "str2");
+    g_log_filter()->set_enabled(true);
+    scoped_func(3, "str3");
+
+    std::string out = g_out.str();
+    BOOST_CHECK( out == 
+        "[1] start of func(1, str=str)\n"
+        "[2] inner\n"
+        "[3]   end of func(1, str=str)\n"
+        "[4] start of func(3, str=str3)\n"
+        "[5] inner\n"
+        "[6]   end of func(3, str=str3)\n"
+        );
+    return 0;
+}
Added: sandbox/logging/lib/logging/tests/test_scoped_log/test_scoped_log.vcproj
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_scoped_log/test_scoped_log.vcproj	2008-02-01 10:55:31 EST (Fri, 01 Feb 2008)
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="test_scoped_log"
+	ProjectGUID="{C9AD7E35-9BCE-48D5-AD4F-7BBDECF0DD30}"
+	RootNamespace="test"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".,../../../.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="D:\boosts\boost_1_33_1\bin\boost\libs\thread\build\libboost_thread.lib\vc-8_0\debug\threading-multi"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\test.cpp"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>