Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2008-01-17 01:13:27


Author: jtorjo
Date: 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
New Revision: 42828
URL: http://svn.boost.org/trac/boost/changeset/42828

Log:
[logging]
v0.20.1, 17 jan 2008
- *** BREAKING CHANGE : when you use the filters/loggers, use them as function names (append "()" to them)
  - Please take a look at the updated examples or at the online help. Thanks for understanding.
Text files modified:
   sandbox/logging/boost/logging/defaults.hpp | 1
   sandbox/logging/boost/logging/detail/cache_before_init_macros.hpp | 19 +--
   sandbox/logging/boost/logging/detail/format_write_detail.hpp | 12 +-
   sandbox/logging/boost/logging/detail/forward_constructor.hpp | 35 ++++++
   sandbox/logging/boost/logging/detail/fwd.hpp | 1
   sandbox/logging/boost/logging/detail/log_keeper.hpp | 126 ++++++++++++++--------
   sandbox/logging/boost/logging/detail/logger.hpp | 222 +++++++++++++++++++++++----------------
   sandbox/logging/boost/logging/detail/macros.hpp | 92 ++++++---------
   sandbox/logging/boost/logging/detail/manipulator.hpp | 27 ++--
   sandbox/logging/boost/logging/detail/raw_doc/caching.hpp | 16 +-
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 10 +
   sandbox/logging/boost/logging/detail/raw_doc/requirements.hpp | 4
   sandbox/logging/boost/logging/detail/raw_doc/scoped_logs.hpp | 4
   sandbox/logging/boost/logging/detail/raw_doc/todo.hpp | 5
   sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp | 22 +-
   sandbox/logging/boost/logging/detail/use_format_write.hpp | 1
   sandbox/logging/boost/logging/detail/util.hpp | 1
   sandbox/logging/boost/logging/format.hpp | 16 +-
   sandbox/logging/boost/logging/format/destination/named.hpp | 2
   sandbox/logging/boost/logging/format/formatter/named_spacer.hpp | 4
   sandbox/logging/boost/logging/format/formatter/spacer.hpp | 4
   sandbox/logging/boost/logging/format_fwd.hpp | 6
   sandbox/logging/boost/logging/logging.hpp | 1
   sandbox/logging/boost/logging/tags.hpp | 22 +-
   sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp | 5
   sandbox/logging/boost/logging/writer/ts_write.hpp | 9
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 9 +
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 20 +-
   sandbox/logging/lib/logging/samples/scenarios/cache_before_init.cpp | 40 +++---
   sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp | 22 +-
   sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp | 14 +-
   sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp | 12 +-
   sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp | 12 +-
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp | 43 +++---
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp | 20 +-
   sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp | 42 +++---
   sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp | 22 +-
   sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp | 18 +-
   sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp | 16 +-
   sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp | 12 +-
   sandbox/logging/lib/logging/samples/scenarios/using_tags.cpp | 12 +-
   sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp | 40 +++---
   42 files changed, 559 insertions(+), 462 deletions(-)

Modified: sandbox/logging/boost/logging/defaults.hpp
==============================================================================
--- sandbox/logging/boost/logging/defaults.hpp (original)
+++ sandbox/logging/boost/logging/defaults.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -74,7 +74,6 @@
 
 
 
- struct override {};
 
     // forward defines
 

Modified: sandbox/logging/boost/logging/detail/cache_before_init_macros.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/cache_before_init_macros.hpp (original)
+++ sandbox/logging/boost/logging/detail/cache_before_init_macros.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -47,7 +47,7 @@
 /////////////////////////////////////////////////////////////////////////////////////////////
 // Messages that were logged before initializing the log - cache the message & the filter
 
-#define BOOST_LOG_USE_LOG_LOCAL_CLASS(l, do_func, is_log_enabled, local_class, param_name) \
+#define BOOST_LOG_USE_LOG(l, do_func, is_log_enabled) \
     if (false) ; else struct local_class { \
         static bool is_enabled_callback() { return (is_log_enabled); } \
         local_class (const void * p) { \
@@ -55,29 +55,24 @@
                 set_callback_if_needed(); \
         } \
         void set_callback_if_needed() { \
- if ( l .base()->cache().is_cache_turned_on() ) \
- l .base()->cache().set_callback( &is_enabled_callback ); \
+ if ( ::boost::logging::get_logger_base( l )->cache().is_cache_turned_on() ) \
+ ::boost::logging::get_logger_base( l )->cache().set_callback( &is_enabled_callback ); \
         } \
- } param_name = ( !(is_log_enabled) ) ? (void*)0 : l .base()-> do_func
-
-
-#define BOOST_LOG_USE_LOG(l, do_func, is_log_enabled) \
- BOOST_LOG_USE_LOG_LOCAL_CLASS( l, do_func, is_log_enabled, local_class_, param_ )
-// BOOST_LOG_USE_LOG_LOCAL_CLASS( l, do_func, is_log_enabled, \
- // BOOST_LOG_CONCATENATE(local_class_,__LINE__), BOOST_LOG_CONCATENATE(param_,__LINE__) )
+ } param = ( !(is_log_enabled) ) ? (void*)0 : ::boost::logging::get_logger_base( l )-> do_func
 
+
 
 #elif defined( BOOST_LOG_BEFORE_INIT_USE_LOG_ALL)
 /////////////////////////////////////////////////////////////////////////////////////////////
 // Messages that were logged before initializing the log - cache the message (and I'll write it even if the filter is turned off)
 
-#define BOOST_LOG_USE_LOG(l, do_func, is_log_enabled) if ( !(is_log_enabled) ) ; else l .base()-> do_func
+#define BOOST_LOG_USE_LOG(l, do_func, is_log_enabled) if ( !(is_log_enabled) ) ; else ::boost::logging::get_logger_base(l)-> do_func
 
 #elif defined( BOOST_LOG_BEFORE_INIT_USE_IGNORE_BEFORE_INIT)
 /////////////////////////////////////////////////////////////////////////////////////////////
 // Messages that were logged before initializing the log - ignore them completely
 
-#define BOOST_LOG_USE_LOG(l, do_func, is_log_enabled) if ( !(is_log_enabled) ) ; else l .base()-> do_func
+#define BOOST_LOG_USE_LOG(l, do_func, is_log_enabled) if ( !(is_log_enabled) ) ; else ::boost::logging::get_logger_base(l)-> do_func
 
 #else
 #error Internal error.

Modified: sandbox/logging/boost/logging/detail/format_write_detail.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/format_write_detail.hpp (original)
+++ sandbox/logging/boost/logging/detail/format_write_detail.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -66,16 +66,16 @@
 typedef logger< gather::ostream_like::return_cache_str<> , format_write< ... > > log_type;
 BOOST_DECLARE_LOG(g_l, log_type)
 BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts )
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // add formatters : [idx] [time] message [enter]
-g_l->writer().add_formatter( formatter::idx() );
-g_l->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
-g_l->writer().add_formatter( formatter::append_newline() );
+g_l()->writer().add_formatter( formatter::idx() );
+g_l()->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
+g_l()->writer().add_formatter( formatter::append_newline() );
 
 // write to cout and file
-g_l->writer().add_destination( destination::cout() );
-g_l->writer().add_destination( destination::file("out.txt") );
+g_l()->writer().add_destination( destination::cout() );
+g_l()->writer().add_destination( destination::file("out.txt") );
 
 // usage
 int i = 1;

Modified: sandbox/logging/boost/logging/detail/forward_constructor.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/forward_constructor.hpp (original)
+++ sandbox/logging/boost/logging/detail/forward_constructor.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -34,6 +34,7 @@
 namespace boost { namespace logging {
 
 #define BOOST_LOGGING_FORWARD_CONSTRUCTOR(class_name,forward_to) \
+ class_name() {} \
         template<class p1> class_name(const p1 & a1 ) : forward_to(a1) {} \
         template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(a1,a2) {} \
         template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(a1,a2,a3) {} \
@@ -41,6 +42,7 @@
         template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(a1,a2,a3,a4,a5) {}
 
 #define BOOST_LOGGING_FORWARD_CONSTRUCTOR_INIT(class_name,forward_to,init) \
+ class_name() { init (); } \
         template<class p1> class_name(const p1 & a1 ) : forward_to(a1) { init(); } \
         template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(a1,a2) { init(); } \
         template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(a1,a2,a3) { init(); } \
@@ -52,6 +54,7 @@
 // workaround for VS - problem with copy constructor
 
 #define BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW(class_name,forward_to,type) \
+ class_name() : forward_to(new type) {} \
         template<class p1> class_name(const p1 & a1 ) { \
             see_if_copy_constructor( a1, forward_to, boost::is_base_of<class_name,p1>() ); \
         } \
@@ -66,14 +69,46 @@
         template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(new type(a1,a2,a3,a4)) {} \
         template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(new type(a1,a2,a3,a4,a5)) {}
 
+
+#define BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW_AND_INIT(class_name,forward_to,type, init) \
+ class_name() : forward_to(new type) { init (); } \
+ template<class p1> class_name(const p1 & a1 ) { \
+ see_if_copy_constructor( a1, forward_to, boost::is_base_of<class_name,p1>() ); \
+ } \
+ template<class p1, class forward_type> void see_if_copy_constructor(const p1 & a1, forward_type&, const boost::true_type& ) { \
+ forward_to = a1.forward_to; \
+ init (); \
+ } \
+ template<class p1, class forward_type> void see_if_copy_constructor(const p1 & a1, forward_type&, const boost::false_type& ) { \
+ forward_to = forward_type(new type(a1)); \
+ init (); \
+ } \
+ template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(new type(a1,a2)) { init (); } \
+ template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(new type(a1,a2,a3)) { init (); } \
+ template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(new type(a1,a2,a3,a4)) { init (); } \
+ template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(new type(a1,a2,a3,a4,a5)) { init (); }
+
+
+
 #else
 #define BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW(class_name,forward_to,type) \
+ class_name() : forward_to(new type) {} \
         template<class p1> class_name(const p1 & a1 ) : forward_to(new type(a1)) {} \
         template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(new type(a1,a2)) {} \
         template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(new type(a1,a2,a3)) {} \
         template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(new type(a1,a2,a3,a4)) {} \
         template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(new type(a1,a2,a3,a4,a5)) {}
 
+
+#define BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW_AND_INIT(class_name,forward_to,type, init) \
+ class_name() : forward_to(new type) { init (); } \
+ template<class p1> class_name(const p1 & a1 ) : forward_to(new type(a1)) { init (); } \
+ template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(new type(a1,a2)) { init (); } \
+ template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(new type(a1,a2,a3)) { init (); } \
+ template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(new type(a1,a2,a3,a4)) { init (); } \
+ template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(new type(a1,a2,a3,a4,a5)) { init (); }
+
+
 #endif
 
 }}

Modified: sandbox/logging/boost/logging/detail/fwd.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/fwd.hpp (original)
+++ sandbox/logging/boost/logging/detail/fwd.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -25,7 +25,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <boost/logging/detail/util.hpp>
-#include <boost/logging/detail/log_keeper.hpp>
 #include <boost/logging/detail/macros.hpp>
 
 #include <boost/logging/detail/ts/ts.hpp>

Modified: sandbox/logging/boost/logging/detail/log_keeper.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/log_keeper.hpp (original)
+++ sandbox/logging/boost/logging/detail/log_keeper.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -28,63 +28,97 @@
 
 namespace detail {
 
- /*
- Note that BOOST_DECLARE_LOG & BOOST_DEFINE_LOG define a function,
- so that we don't run into the problem of using an object before it's initialized.
+ template<class T> struct fast_compile_with_default_gather ;
 
- However, client code doesn't need to be aware of that.
- So, for instance, clients will say:
 
- typedef logger<...> app_log;
- BOOST_DEFINE_LOG(g_l,app_log);
+} // namespace detail
 
- g_l->writer().add_formatter( formatter::idx() );
- */
- template<class type, type& (*func)(), class base_type = type, base_type& (*base_func)() = func > struct log_keeper {
 
- const type* operator->() const { return &func(); }
- type* operator->() { return &func(); }
+/**
+ @brief Allows using a log without knowing its full type yet. Even if the log is not fully @b defined, you can still use it.
 
- const base_type* base() const { return &base_func(); }
- base_type* base() { return &base_func(); }
- };
+ This will allow you to log messages even if you don't know the full type of the log (which can aid compilation time).
+*/
+template<class type, class gather_msg = default_, class dummy = override> struct log_holder {
+ typedef typename use_default<gather_msg, typename ::boost::logging::detail::fast_compile_with_default_gather<dummy>::gather_msg > ::type gather_type;
+ typedef logger<gather_type> logger_base;
+
+ BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW_AND_INIT(log_holder, m_log, type, init)
+ ~log_holder() {
+ delete m_base;
+ m_base = 0;
+ delete m_log;
+ m_log = 0;
+ }
 
- struct fake_using_log {
- template<class type> fake_using_log( type & log) {
-#ifndef BOOST_NO_INT64_T
- typedef boost::int64_t long_type ;
-#else
- typedef long long_type ;
-#endif
- long_type ignore = reinterpret_cast<long_type>(&log);
- // we need to force the compiler to force creation of the log
- if ( time(0) < 0)
- if ( time(0) < (time_t)ignore) {
- printf("LOGGING LIB internal error - should NEVER happen. Please report this to the author of the lib");
- exit(0);
- }
- }
- };
-
-
- /*
- Note that BOOST_DECLARE_LOG_FILTER & BOOST_DEFINE_LOG_FILTER define a function,
- so that we don't run into the problem of using an object before it's initialized.
+ const type* operator->() const { return m_log; }
+ type* operator->() { return m_log; }
 
- However, client code doesn't need to be aware of that.
- So, for instance, clients will say:
+ /**
+ in case you want to get the real log object
+ */
+ const type* get() const { return m_log; }
+ type* get() { return m_log; }
 
- BOOST_DEFINE_LOG_FILTER(g_level_holder, level::holder);
 
- g_level_holder->set_enabled(level::debug);
- */
- template<class type, type& (*func)() > struct log_filter_keeper {
+ const logger_base * base() const { return m_base; }
+ logger_base * base() { return m_base; }
 
- const type* operator->() const { return &(func()); }
- type* operator->() { return &(func()); }
- };
+private:
+ void init() {
+ m_base = 0;
+ typedef typename type::write_type write_type;
+ m_base = new forward_to_logger<gather_type, write_type>(m_log);
+ }
+private:
+ type * m_log;
+ logger_base * m_base;
+};
+
+/**
+ @brief Ensures the log is created before main(), even if not used before main
+
+ We need this, so that we won't run into multi-threaded issues while the log is created
+ (in other words, if the log is created before main(), we can safely assume there's only one thread running,
+ thus no multi-threaded issues)
+*/
+struct ensure_early_log_creation {
+ template<class type> ensure_early_log_creation ( type & log) {
+#ifndef BOOST_NO_INT64_T
+ typedef boost::int64_t long_type ;
+#else
+ typedef long long_type ;
+#endif
+ long_type ignore = reinterpret_cast<long_type>(&log);
+ // we need to force the compiler to force creation of the log
+ if ( time(0) < 0)
+ if ( time(0) < (time_t)ignore) {
+ printf("LOGGING LIB internal error - should NEVER happen. Please report this to the author of the lib");
+ exit(0);
+ }
+ }
+};
+
+
+/**
+ @brief Ensures the filter is created before main(), even if not used before main
+
+ We need this, so that we won't run into multi-threaded issues while the filter is created
+ (in other words, if the filter is created before main(), we can safely assume there's only one thread running,
+ thus no multi-threaded issues)
+*/
+typedef ensure_early_log_creation ensure_early_filter_creation;
+
+/**
+ Useful for log_holder - to get the logger' base (so that we can use it even without knowing the full log's definition).
+
+ If used on a logger, it just returns it .
+*/
+template<class logger> inline logger* get_logger_base(logger * l) { return l; }
+template<class logger> inline const logger* get_logger_base(const logger * l) { return l; }
 
-} // namespace detail
+template<class type, class gather_msg> inline typename log_holder<type,gather_msg>::logger_base* get_logger_base(log_holder<type,gather_msg> & l) { return l.base(); }
+template<class type, class gather_msg> inline const typename log_holder<type,gather_msg>::logger_base* get_logger_base(const log_holder<type,gather_msg> & l) { return l.base(); }
 
 
 

Modified: sandbox/logging/boost/logging/detail/logger.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/logger.hpp (original)
+++ sandbox/logging/boost/logging/detail/logger.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -25,6 +25,7 @@
 #include <boost/logging/detail/forward_constructor.hpp>
 #include <boost/logging/detail/find_gather.hpp>
 #include <boost/logging/detail/cache_before_init.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
 
 namespace boost { namespace logging {
 
@@ -116,7 +117,7 @@
     BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts )
     BOOST_DECLARE_LOG(g_l, log_type)
 
- #define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+ #define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
     // usage
     L_ << "this is so cool " << i++;
@@ -131,20 +132,24 @@
     - check out the writer namespace
     
     */
- template<class gather_msg = default_, class write_msg = default_ > struct logger
+ template<class gather_msg = default_, class write_msg = default_ > struct logger ;
+
+
+ // specialize when write_msg is not set - in this case, you need to derive from this
+ template<class gather_msg> struct logger<gather_msg, default_ >
             : detail::default_cache_keeper< detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > > {
         typedef typename detail::find_gather_if_default<gather_msg>::gather_type gather_type;
- typedef write_msg write_type;
         typedef detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > cache_type;
+ typedef void_ write_type;
         typedef detail::default_cache_keeper<cache_type> cache_base;
         using cache_base::cache;
 
- typedef logger<gather_msg, write_msg> self;
+ typedef logger<gather_msg, default_> self;
+ typedef typename gather_type::msg_type msg_type;
 
         logger() {}
- BOOST_LOGGING_FORWARD_CONSTRUCTOR(logger,m_writer)
-
- ~logger() {
+ // we have virtual functions, lets have a virtual destructor as well - many thanks Martin Baeker!
+ virtual ~logger() {
             // force writing all messages from cache, if cache hasn't been turned off yet
             turn_cache_off();
         }
@@ -152,58 +157,118 @@
         /**
             reads all data about a log message (gathers all the data about it)
         */
- gather_holder<self, gather_type> read_msg() const { return gather_holder<self, gather_type>(*this) ; }
+ gather_holder<self, gather_msg> read_msg() const { return gather_holder<self, gather_msg>(*this) ; }
 
- write_msg & writer() { return m_writer; }
- const write_msg & writer() const { return m_writer; }
+ write_type & writer() { return m_writer; }
+ const write_type & writer() const { return m_writer; }
+
+ const logger* base() const { return this; }
+ logger* base() { return this; }
 
+ private:
+ struct call_do_write {
+ const logger & self;
+ call_do_write(const logger & self) : self(self) {}
+ void operator()(msg_type & msg) const {
+ self.do_write(msg);
+ }
+ };
+ public:
         // called after all data has been gathered
- void on_do_write(gather_type & gather) const {
- cache().on_do_write( detail::as_non_const(gather.msg()), writer() );
+ void on_do_write(gather_msg & gather) const {
+ cache().on_do_write( detail::as_non_const(gather.msg()), call_do_write(*this) );
         }
         void turn_cache_off() {
- cache().turn_cache_off( writer() );
+ cache().turn_cache_off( call_do_write(*this) );
         }
 
+ virtual void do_write(msg_type&) const = 0;
     private:
- write_msg m_writer;
+ // we don't know the writer
+ void_ m_writer;
     };
 
- // specialize for write_msg* pointer!
- template<class gather_msg, class write_msg> struct logger<gather_msg, write_msg* >
+
+ /**
+ @brief Forwards everything to a different logger.
+
+ This includes:
+ - the writing (writer)
+ - the caching
+ - the on_destroyed (if present)
+ */
+ template<class gather_msg, class write_msg> struct forward_to_logger : logger<gather_msg, default_> {
+ typedef typename detail::find_gather_if_default<gather_msg>::gather_type gather_type;
+ typedef typename gather_type::msg_type msg_type;
+ typedef detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > cache_type;
+ typedef logger<gather_msg, default_> log_base;
+ // ... might be called for a specialization of logger - for logger<gather_msg,write_msg*>
+ typedef typename boost::remove_pointer<write_msg>::type write_type;
+
+ typedef logger<gather_msg, write_msg> original_logger_type;
+ forward_to_logger(original_logger_type *original_logger = 0) : m_original_logger( original_logger), m_writer(0) {
+ if ( m_original_logger)
+ m_writer = &m_original_logger->writer();
+ }
+
+ /**
+ specifies the logger to forward to
+ */
+ void forward_to(original_logger_type *original_logger) {
+ m_original_logger = original_logger;
+ m_writer = &m_original_logger->writer();
+ }
+
+ virtual void do_write(msg_type &a) const {
+ (*m_writer)(a);
+ }
+
+ virtual cache_type & cache() { return m_original_logger->cache(); }
+ virtual const cache_type & cache() const { return m_original_logger->cache(); }
+
+ private:
+ write_type* m_writer;
+ original_logger_type * m_original_logger;
+ };
+
+
+
+ // default implementation - when gather_msg and write_msg are both known
+ template<class gather_msg , class write_msg > struct logger
             : detail::default_cache_keeper< detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > > {
         typedef typename detail::find_gather_if_default<gather_msg>::gather_type gather_type;
+ typedef write_msg write_type;
         typedef detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > cache_type;
         typedef detail::default_cache_keeper<cache_type> cache_base;
+ typedef logger<gather_type> logger_base_type;
         using cache_base::cache;
- typedef write_msg write_type;
 
- typedef logger<gather_msg, write_msg*> self;
+ typedef logger<gather_msg, write_msg> self;
+
+ BOOST_LOGGING_FORWARD_CONSTRUCTOR_INIT(logger,m_writer, init)
 
- logger(write_msg * writer = 0) : m_writer(writer) {
- }
         ~logger() {
             // force writing all messages from cache, if cache hasn't been turned off yet
             turn_cache_off();
         }
 
- void set_writer(write_msg* writer) {
- m_writer = writer;
- }
-
         /**
             reads all data about a log message (gathers all the data about it)
         */
- gather_holder<self, gather_msg> read_msg() const { return gather_holder<self, gather_msg>(*this) ; }
+ gather_holder<self, gather_type> read_msg() const { return gather_holder<self, gather_type>(*this) ; }
 
- write_msg & writer() { return *m_writer; }
- const write_msg & writer() const { return *m_writer; }
+ write_msg & writer() { return m_writer; }
+ const write_msg & writer() const { return m_writer; }
 
- virtual cache_type & cache() { return m_cache; }
- virtual const cache_type & cache() const { return m_cache; }
+ /**
+ ... returns a base object - one that can be used to log messages, without having to know the full log's definition (its declaration is enough).
+ Thus, it can also be passed between a library and the application that uses it, and vice-versa.
+ */
+ const logger_base_type* base() const { return m_base; }
+ logger_base_type* base() { return m_base; }
 
         // called after all data has been gathered
- void on_do_write(gather_msg & gather) const {
+ void on_do_write(gather_type & gather) const {
             cache().on_do_write( detail::as_non_const(gather.msg()), writer() );
         }
         void turn_cache_off() {
@@ -211,66 +276,71 @@
         }
 
     private:
- write_msg *m_writer;
- cache_type m_cache;
- };
+ void init() {
+ m_base.forward_to(this);
+ }
 
+ private:
+ write_msg m_writer;
+ // a base object - one that can be used to log messages, without having to know the full type of the log.
+ forward_to_logger<gather_msg, write_type> m_base;
+ };
 
- // specialize when write_msg is not set - in this case, you need to derive from this
- template<class gather_msg> struct logger<gather_msg, default_ >
+ // specialize for write_msg* pointer!
+ template<class gather_msg, class write_msg> struct logger<gather_msg, write_msg* >
             : detail::default_cache_keeper< detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > > {
         typedef typename detail::find_gather_if_default<gather_msg>::gather_type gather_type;
         typedef detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > cache_type;
- typedef void_ write_type;
         typedef detail::default_cache_keeper<cache_type> cache_base;
+ typedef logger<gather_type> logger_base_type;
         using cache_base::cache;
+ typedef write_msg write_type;
 
- typedef logger<gather_msg, default_> self;
- typedef typename gather_msg::msg_type msg_type;
+ typedef logger<gather_msg, write_msg*> self;
 
- logger() : m_cache(0) {}
- // we have virtual functions, lets have a virtual destructor as well - many thanks Martin Baeker!
- virtual ~logger() {
+ logger(write_msg * writer = 0) : m_writer(writer) {
+ m_base.forward_to(this);
+ }
+ ~logger() {
             // force writing all messages from cache, if cache hasn't been turned off yet
             turn_cache_off();
         }
 
+ void set_writer(write_msg* writer) {
+ m_writer = writer;
+ }
+
         /**
             reads all data about a log message (gathers all the data about it)
         */
         gather_holder<self, gather_msg> read_msg() const { return gather_holder<self, gather_msg>(*this) ; }
 
- write_type & writer() { return m_writer; }
- const write_type & writer() const { return m_writer; }
+ write_msg & writer() { return *m_writer; }
+ const write_msg & writer() const { return *m_writer; }
 
- void set_cache(cache_type * cache_) {
- m_cache = cache_;
- }
+ /**
+ ... returns a base object - one that can be used to log messages, without having to know the full type of the log.
+ Thus, it can also be passed between a library and the application that uses it, and vice-versa.
+ */
+ const logger_base_type* base() const { return m_base; }
+ logger_base_type* base() { return m_base; }
 
- private:
- struct call_do_write {
- const logger & self;
- call_do_write(const logger & self) : self(self) {}
- void operator()(msg_type & msg) const {
- self.do_write(msg);
- }
- };
- public:
         // called after all data has been gathered
         void on_do_write(gather_msg & gather) const {
- cache().on_do_write( detail::as_non_const(gather.msg()), call_do_write(*this) );
+ cache().on_do_write( detail::as_non_const(gather.msg()), writer() );
         }
         void turn_cache_off() {
- cache().turn_cache_off( call_do_write(*this) );
+ cache().turn_cache_off( writer() );
         }
 
- virtual void do_write(msg_type&) const = 0;
     private:
- // we don't know the writer
- void_ m_writer;
- cache_type *m_cache;
+ write_msg *m_writer;
+ // a base object - one that can be used to log messages, without having to know the full type of the log.
+ forward_to_logger<gather_msg, write_type*> m_base;
     };
 
+
+
     /**
     
     @param write_msg the write message class. If a pointer, forwards to a pointer. If not a pointer, it holds it by value.
@@ -278,7 +348,6 @@
     template<class gather_msg, class write_msg> struct implement_default_logger : logger<gather_msg, default_> {
         typedef typename gather_msg::msg_type msg_type;
 
- implement_default_logger() {}
         BOOST_LOGGING_FORWARD_CONSTRUCTOR(implement_default_logger,m_writer)
 
         virtual void do_write(msg_type &a) const {
@@ -309,35 +378,6 @@
     };
 
 
- /**
- @brief Forwards everything to a different logger.
-
- This includes:
- - the writing (writer)
- - the caching
- - the on_destroyed (if present)
- */
- template<class gather_msg, class write_msg> struct forward_to_logger : logger<gather_msg, default_> {
- typedef typename gather_msg::msg_type msg_type;
- typedef detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > cache_type;
- typedef logger<gather_msg, default_> log_base;
-
- typedef logger<gather_msg, write_msg> original_logger_type;
- forward_to_logger(original_logger_type &original_logger) : m_original_logger( &original_logger) {
- m_writer = &m_original_logger->writer();
- }
-
- virtual void do_write(msg_type &a) const {
- (*m_writer)(a);
- }
-
- virtual cache_type & cache() { return m_original_logger->cache(); }
- virtual const cache_type & cache() const { return m_original_logger->cache(); }
-
- private:
- write_msg * m_writer;
- original_logger_type * m_original_logger;
- };
 
 
 

Modified: sandbox/logging/boost/logging/detail/macros.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/macros.hpp (original)
+++ sandbox/logging/boost/logging/detail/macros.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -167,7 +167,7 @@
 @code
 typedef logger< default_, destination::file> err_log_type;
 ...
-BOOST_DEFINE_LOG_WITH_ARGS( g_log_err, err_log_type, ("err.txt") )
+BOOST_DEFINE_LOG_WITH_ARGS( g_log_err(), err_log_type, ("err.txt") )
 @endcode
 
 
@@ -231,7 +231,7 @@
 BOOST_DECLARE_LOG_FILTER(g_log_level, boost::logging::level::holder )
 BOOST_DECLARE_LOG(g_log_err, log_type)
 
-#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_err, g_log_level, error )
+#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_err(), g_log_level(), error )
 @endcode
 
 @subsubsection BOOST_LOG_USE_LOG_IF_FILTER BOOST_LOG_USE_LOG_IF_FILTER
@@ -244,7 +244,7 @@
 
 Example:
 @code
-#define LERR_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_err, g_log_filter->is_enabled() )
+#define LERR_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_err(), g_log_filter()->is_enabled() )
 @endcode
 
 
@@ -280,7 +280,7 @@
 
 typedef logger< no_gather, destination::cout > app_log_type;
 
-#define LAPP_ BOOST_LOG_USE_SIMPLE_LOG_IF_FILTER(g_log_app, g_log_filter->is_enabled() )
+#define LAPP_ BOOST_LOG_USE_SIMPLE_LOG_IF_FILTER(g_log_app(), g_log_filter()->is_enabled() )
 @endcode
 
 
@@ -346,7 +346,7 @@
 Example:
 
 @code
-#define L_(module_name) BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) .set_tag( BOOST_LOG_TAG(module)(module_name) )
+#define L_(module_name) BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) .set_tag( BOOST_LOG_TAG(module)(module_name) )
 @endcode
 
 @subsubsection BOOST_LOG_TAG_LEVEL BOOST_LOG_TAG_LEVEL
@@ -360,8 +360,8 @@
 Example:
 
 @code
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg, g_log_level, debug ) .set_tag( BOOST_LOG_TAG_LEVEL(debug) )
-#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg, g_log_level, error ) .set_tag( BOOST_LOG_TAG_LEVEL(error) )
+#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg(), g_log_level(), debug ) .set_tag( BOOST_LOG_TAG_LEVEL(debug) )
+#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg(), g_log_level(), error ) .set_tag( BOOST_LOG_TAG_LEVEL(error) )
 @endcode
 
 @subsubsection BOOST_LOG_TAG_FILELINE BOOST_LOG_TAG_FILELINE
@@ -375,7 +375,7 @@
 Example:
 
 @code
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) .set_tag( BOOST_LOG_TAG_FILELINE)
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) .set_tag( BOOST_LOG_TAG_FILELINE)
 @endcode
 
 @subsubsection BOOST_LOG_TAG_FUNCTION BOOST_LOG_TAG_FUNCTION
@@ -389,7 +389,7 @@
 Example:
 
 @code
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) .set_tag( BOOST_LOG_TAG_FUNCTION)
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) .set_tag( BOOST_LOG_TAG_FUNCTION)
 @endcode
 
 
@@ -530,47 +530,28 @@
 
 #ifdef BOOST_LOG_COMPILE_FAST
 // ****** Fast compile ******
+#define BOOST_DECLARE_LOG(name,type) ::boost::logging::log_holder< type > & name ();
 
-#define BOOST_DECLARE_LOG(name,type) \
- type& name ## _boost_log_impl_(); \
- ::boost::logging::detail::fast_compile_with_default_gather<>::log_type & name ## _boost_log_impl_light_(); \
- extern boost::logging::detail::log_keeper<type, name ## _boost_log_impl_, ::boost::logging::detail::fast_compile_with_default_gather<>::log_type, name ## _boost_log_impl_light_ > name;
-
-#define BOOST_DEFINE_LOG(name,type) type& name ## _boost_log_impl_() \
- { static type i; return i; } \
- ::boost::logging::detail::fast_compile_with_default_gather<>::log_type & name ## _boost_log_impl_light_() \
- { typedef ::boost::logging::detail::fast_compile_with_default_gather<>::gather_msg gather_msg; \
- typedef type::write_type write_msg; \
- static ::boost::logging::forward_to_logger< gather_msg, write_msg > p( name ## _boost_log_impl_() ); \
- return p; } \
- namespace { boost::logging::detail::fake_using_log ensure_log_is_created_before_main ## name ( name ## _boost_log_impl_() ); } \
- boost::logging::detail::log_keeper<type, name ## _boost_log_impl_, ::boost::logging::detail::fast_compile_with_default_gather<>::log_type, name ## _boost_log_impl_light_ > name;
-
-#define BOOST_DEFINE_LOG_WITH_ARGS(name,type, args) type& name ## _boost_log_impl_() \
- { static type i ( args ); return i; } \
- ::boost::logging::detail::fast_compile_with_default_gather<>::log_type & name ## _boost_log_impl_light_() \
- { typedef ::boost::logging::detail::fast_compile_with_default_gather<>::gather_msg gather_msg; \
- typedef type::write_type write_msg; \
- static ::boost::logging::implement_default_logger< gather_msg, write_msg* > p( &(name ## _boost_log_impl_().writer()), &(name ## _boost_log_impl_().cache()) ); \
- return p; } \
- namespace { boost::logging::detail::fake_using_log ensure_log_is_created_before_main ## name ( name ## _boost_log_impl_() ); } \
- boost::logging::detail::log_keeper<type, name ## _boost_log_impl_, ::boost::logging::detail::fast_compile_with_default_gather<>::log_type, name ## _boost_log_impl_light_ > name;
-
+#define BOOST_DEFINE_LOG(name,type) ::boost::logging::log_holder< type > & name () \
+ { static ::boost::logging::log_holder< type > l; return l; } \
+ namespace { boost::logging::ensure_early_log_creation ensure_log_is_created_before_main ## name ( name () ); }
+
+#define BOOST_DEFINE_LOG_WITH_ARGS(name,type, args) ::boost::logging::log_holder< type > & name () \
+ { static ::boost::logging::log_holder< type > l ( args ); return l; } \
+ namespace { boost::logging::ensure_early_log_creation ensure_log_is_created_before_main ## name ( name () ); }
 
 
 #else
 // don't compile fast
-#define BOOST_DECLARE_LOG(name,type) type& name ## _boost_log_impl_(); extern boost::logging::detail::log_keeper<type, name ## _boost_log_impl_ > name;
-#define BOOST_DEFINE_LOG(name,type) type& name ## _boost_log_impl_() \
- { static type i; return i; } \
- namespace { boost::logging::detail::fake_using_log ensure_log_is_created_before_main ## name ( name ## _boost_log_impl_() ); } \
- boost::logging::detail::log_keeper<type, name ## _boost_log_impl_ > name;
-
-#define BOOST_DEFINE_LOG_WITH_ARGS(name,type, args) type& name ## _boost_log_impl_() \
- { static type i ( args); return i; } \
- namespace { boost::logging::detail::fake_using_log ensure_log_is_created_before_main ## name ( name ## _boost_log_impl_() ); } \
- boost::logging::detail::log_keeper<type, name ## _boost_log_impl_ > name;
+#define BOOST_DECLARE_LOG(name,type) type* name ();
 
+#define BOOST_DEFINE_LOG(name,type) type* name () \
+ { static type l; return &l; } \
+ namespace { boost::logging::ensure_early_log_creation ensure_log_is_created_before_main ## name ( * name () ); }
+
+#define BOOST_DEFINE_LOG_WITH_ARGS(name,type, args) type* name () \
+ { static type l ( args ); return &l; } \
+ namespace { boost::logging::ensure_early_log_creation ensure_log_is_created_before_main ## name ( * name () ); }
 
 #endif
 
@@ -578,19 +559,22 @@
 
 
 
+
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Filter Macros
 
-#define BOOST_DECLARE_LOG_FILTER(name,type) type& name ## _boost_log_filter_impl_(); extern boost::logging::detail::log_filter_keeper<type, name ## _boost_log_filter_impl_ > name;
-#define BOOST_DEFINE_LOG_FILTER(name,type) type& name ## _boost_log_filter_impl_() \
- { static type i; return i; } \
- namespace { boost::logging::detail::fake_using_log ensure_log_is_created_before_main ## name ( name ## _boost_log_filter_impl_() ); } \
- boost::logging::detail::log_filter_keeper<type, name ## _boost_log_filter_impl_ > name;
-
-#define BOOST_DEFINE_LOG_FILTER_WITH_ARGS(name,type, args) type& name ## _boost_log_filter_impl_() \
- { static type i ( args ); return i; } \
- namespace { boost::logging::detail::fake_using_log ensure_log_is_created_before_main ## name ( name ## _boost_log_filter_impl_() ); } \
- boost::logging::detail::log_filter_keeper<type, name ## _boost_log_filter_impl_ > name;
+#define BOOST_DECLARE_LOG_FILTER(name,type) type* name ();
+#define BOOST_DEFINE_LOG_FILTER(name,type) type * name () \
+ { static type l; return &l; } \
+ namespace { boost::logging::ensure_early_log_creation ensure_log_is_created_before_main ## name ( * name () ); }
+
+#define BOOST_DEFINE_LOG_FILTER_WITH_ARGS(name,type, args) type * name () { \
+ { static type l ( args ); return &l; } \
+ namespace { boost::logging::ensure_early_log_creation ensure_log_is_created_before_main ## name ( * name () ); }
+
+
+
+
 
 
 

Modified: sandbox/logging/boost/logging/detail/manipulator.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/manipulator.hpp (original)
+++ sandbox/logging/boost/logging/detail/manipulator.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -163,13 +163,13 @@
 
 @code
 // add formatters : [idx] [time] message [enter]
-g_l->writer().add_formatter( formatter::idx() );
-g_l->writer().add_formatter( formatter::time() );
-g_l->writer().add_formatter( formatter::append_newline() );
+g_l()->writer().add_formatter( formatter::idx() );
+g_l()->writer().add_formatter( formatter::time() );
+g_l()->writer().add_formatter( formatter::append_newline() );
 
 // write to cout and file
-g_l->writer().add_destination( destination::cout() );
-g_l->writer().add_destination( destination::file("out.txt") );
+g_l()->writer().add_destination( destination::cout() );
+g_l()->writer().add_destination( destination::file("out.txt") );
 @endcode
 
 In the above case, if you were to write:
@@ -283,9 +283,9 @@
 
 @code
 // macros through which you'll do logging
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, debug )
-#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, error )
-#define LAPP_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, info )
+#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), debug )
+#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), error )
+#define LAPP_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), info )
 
 // doing logging in code
 int i = 1;
@@ -295,12 +295,12 @@
 std::string hello = "hello", world = "world";
 LAPP_ << hello << ", " << world;
 
-g_log_level->set_enabled(level::error);
+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);
+g_log_level()->set_enabled(level::info);
 LAPP_ << "good to be back ;) " << i++;
 LERR_ << "third error " << i++;
 
@@ -402,7 +402,6 @@
     typedef boost::shared_ptr<context_type> ptr_type;
 
 protected:
- non_const_context() : m_context(new context_type) {}
     non_const_context(const non_const_context& other) : m_context(other.m_context) {}
     
     BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW(non_const_context,m_context,context_type)
@@ -441,15 +440,15 @@
 
 @code
 typedef ... formatter_base;
-logger< format_write<...> > g_l;
+logger< format_write<...> > g_l();
 
 struct my_cool_formatter : formatter_base { ... };
 
 // adding formatter class from the Logging lib
-g_l.add_formatter( formatter::thread_id() );
+g_l().add_formatter( formatter::thread_id() );
 
 // adding formatter class defined by you
-g_l.add_formatter( my_cool_formatter() );
+g_l().add_formatter( my_cool_formatter() );
 @endcode
 
 @sa boost::logging::destination::convert, boost::logging::formatter::convert

Modified: sandbox/logging/boost/logging/detail/raw_doc/caching.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/caching.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/caching.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -63,12 +63,12 @@
 
 @code
 ...
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 ...
 
 L_ << "this message will not be logged";
-g_log_filter->set_enabled(false);
-g_l->turn_cache_off();
+g_log_filter()->set_enabled(false);
+g_l()->turn_cache_off();
 @endcode
 
 
@@ -81,12 +81,12 @@
 
 @code
 ...
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 ...
 
 L_ << "this message will be logged, even if filter will be turned off";
-g_log_filter->set_enabled(false);
-g_l->turn_cache_off();
+g_log_filter()->set_enabled(false);
+g_l()->turn_cache_off();
 @endcode
 
 
@@ -99,11 +99,11 @@
 
 @code
 ...
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 ...
 
 L_ << "this message will NOT be logged";
-g_l->turn_cache_off();
+g_l()->turn_cache_off();
 @endcode
 
 

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-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -1,7 +1,11 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.14.1, 17 jan 2008
+@section changelog_cur_ver Current Version: v0.20.1, 17 jan 2008
+- *** BREAKING CHANGE : when you use the filters/loggers, use them as function names (append "()" to them)
+ - Please take a look at the updated examples or at the online help. Thanks for understanding.
+
+v0.14.1, 17 jan 2008
 - added test_after_destroyed - works on VC8
 - moved logger::cached into a base class and made it virtual
 
@@ -140,9 +144,9 @@
   - filters are declared with BOOST_DECLARE_LOG_FILTER, and defined with BOOST_DEFINE_LOG_FILTER
   - filters are now used with operator->, instead of "."
   - Example:
- BOOST_DEFINE_LOG_LEVEL(g_log_level, level::holder )
+ BOOST_DEFINE_LOG_LEVEL(g_log_level(), level::holder )
                 ...
- g_log_level->set_enabled(level::error);
+ g_log_level()->set_enabled(level::error);
   - rationale: filters, same as levels, could be used before main
 
 

Modified: sandbox/logging/boost/logging/detail/raw_doc/requirements.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/requirements.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/requirements.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -83,9 +83,9 @@
 
 @code
 #ifndef ELIMINATE_LOG_STATEMENTS
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) .set_tag( BOOST_LOG_TAG_FILELINE)
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) .set_tag( BOOST_LOG_TAG_FILELINE)
 #else
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 #endif
 @endcode
 

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-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -71,7 +71,7 @@
 Example:
 
 @code
-#define LDBG BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_filter, debug )
+#define LDBG BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_filter(), debug )
 ...
 
 void func(int a, const char * str) {
@@ -100,7 +100,7 @@
 Example:
 
 @code
-#define LDBG BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_filter, debug )
+#define LDBG BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_filter(), debug )
 ...
 void func(int a, const char * str) {
     BOOST_SCOPED_LOG(LDBG << , "testing inout" );

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-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -24,9 +24,10 @@
 
 - @c normal on_dedicated_thead - remove dependency on boost::thread
 
-- @c high What should I do if someone is trying to use the log after it's been destroyed?
+- @c low in the same way I've created convert_to_base(), I can create a convert_to_top(), on top of which
+ I can create my own way to gather message, and then write it.
 
-- @c high Provide a Jamfile to build the examples/tests
+- @c high What should I do if someone is trying to use the log after it's been destroyed?
 
 - @c high test TSS on vs2003 and gcc/pthreads \n
   (note: tested on pthreads; however - about internal implementation : 2 TSS objects are leaked on pthreads, need to see why)

Modified: sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -51,7 +51,7 @@
 BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts )
 BOOST_DECLARE_LOG(g_l, log_type)
 
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 
 // Example 2 : 1 filter (containing a level), several loggers
@@ -60,9 +60,9 @@
 BOOST_DECLARE_LOG(g_log_app, log_type)
 BOOST_DECLARE_LOG(g_log_dbg, log_type)
 
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg, g_log_level, debug )
-#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 )
+#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg(), g_log_level(), debug )
+#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 )
 @endcode
 
 Every time, before anything gets written to the log, the filter is asked if "it's enabled". If so, the processing of the message takes place
@@ -155,16 +155,16 @@
 BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts )
 BOOST_DECLARE_LOG(g_l, log_type)
 
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // add formatters : [idx] [time] message <enter>
-g_l->writer().add_formatter( formatter::idx() );
-g_l->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
-g_l->writer().add_formatter( formatter::append_newline() );
+g_l()->writer().add_formatter( formatter::idx() );
+g_l()->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
+g_l()->writer().add_formatter( formatter::append_newline() );
 // add destinations : console, output debug window, and a file called "out.txt"
-g_l->writer().add_destination( destination::cout() );
-g_l->writer().add_destination( destination::dbg_window() );
-g_l->writer().add_destination( destination::file("out.txt") );
+g_l()->writer().add_destination( destination::cout() );
+g_l()->writer().add_destination( destination::dbg_window() );
+g_l()->writer().add_destination( destination::file("out.txt") );
 
 // usage
 int i = 1;

Modified: sandbox/logging/boost/logging/detail/use_format_write.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/use_format_write.hpp (original)
+++ sandbox/logging/boost/logging/detail/use_format_write.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -161,7 +161,6 @@
>
      logger_base_type;
 
- logger_format_write() {}
     BOOST_LOGGING_FORWARD_CONSTRUCTOR(logger_format_write, logger_base_type)
 };
 

Modified: sandbox/logging/boost/logging/detail/util.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/util.hpp (original)
+++ sandbox/logging/boost/logging/detail/util.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -30,6 +30,7 @@
 
 namespace boost { namespace logging {
 
+ struct override {};
 
     struct default_ {};
     template<class param, class default_type> struct use_default { typedef param type; };

Modified: sandbox/logging/boost/logging/format.hpp
==============================================================================
--- sandbox/logging/boost/logging/format.hpp (original)
+++ sandbox/logging/boost/logging/format.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -236,16 +236,16 @@
 typedef logger< gather::ostream_like::return_str<> , 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() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // add formatters : [idx] [time] message [enter]
-g_l->writer().add_formatter( write_idx() );
-g_l->writer().add_formatter( write_time() );
-g_l->writer().add_formatter( append_newline() );
+g_l()->writer().add_formatter( write_idx() );
+g_l()->writer().add_formatter( write_time() );
+g_l()->writer().add_formatter( append_newline() );
 
 // write to cout and file
-g_l->writer().add_destination( write_to_cout() );
-g_l->writer().add_destination( write_to_file("out.txt") );
+g_l()->writer().add_destination( write_to_cout() );
+g_l()->writer().add_destination( write_to_file("out.txt") );
 
 // usage
 int i = 1;
@@ -333,9 +333,9 @@
     typedef logger< default_,
         writer::format_write< format_base, destination_base, format_and_write::simple<cache_string>,
             msg_route::with_route<format_base,destination_base> > > log_type;
- log_type g_l;
+ log_type g_l();
 
- g_l->writer().router().set_route()
+ g_l()->writer().router().set_route()
         .fmt( formatter::time() )
         .fmt( formatter::append_newline() )
         .dest( destination::dbg_window() )

Modified: sandbox/logging/boost/logging/format/destination/named.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/destination/named.hpp (original)
+++ sandbox/logging/boost/logging/format/destination/named.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -143,7 +143,7 @@
 Example:
 
 @code
-g_l->writer().add_destination(
+g_l()->writer().add_destination(
     destination::named("cout out debug")
         .add( "cout", destination::cout())
         .add( "debug", destination::dbg_window() )

Modified: sandbox/logging/boost/logging/format/formatter/named_spacer.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/formatter/named_spacer.hpp (original)
+++ sandbox/logging/boost/logging/format/formatter/named_spacer.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -208,9 +208,9 @@
 Example:
 
 @code
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
-g_l->writer().add_formatter( formatter::named_spacer("[%index%] %time% (T%thread%) ")
+g_l()->writer().add_formatter( formatter::named_spacer("[%index%] %time% (T%thread%) ")
         .add( "index", formatter::idx())
         .add( "thread", formatter::thread_id())
         .add( "time", formatter::time("$mm")) );

Modified: sandbox/logging/boost/logging/format/formatter/spacer.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/formatter/spacer.hpp (original)
+++ sandbox/logging/boost/logging/format/formatter/spacer.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -76,14 +76,14 @@
 When adding a spacer formatter, you'll do something similar to:
 
 @code
-g_l->writer().add_formatter( formatter::spacer( formatter::idx(), "[%] ") );
+g_l()->writer().add_formatter( formatter::spacer( formatter::idx(), "[%] ") );
 @endcode
 
 However, to make this even simpler, I allow an ever easier syntax:
 
 @code
 // equivalent to the above
-g_l->writer().add_formatter( formatter::idx(), "[%] " );
+g_l()->writer().add_formatter( formatter::idx(), "[%] " );
 @endcode
 
 

Modified: sandbox/logging/boost/logging/format_fwd.hpp
==============================================================================
--- sandbox/logging/boost/logging/format_fwd.hpp (original)
+++ sandbox/logging/boost/logging/format_fwd.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -72,9 +72,9 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 BOOST_DECLARE_LOG_FILTER(g_l_filter, level::holder)
 
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, debug ) << "[dbg] "
-#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, error ) << "[ERR] "
-#define LAPP_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, info ) << "[app] "
+#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), debug ) << "[dbg] "
+#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), error ) << "[ERR] "
+#define LAPP_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), info ) << "[app] "
 
 void init_logs();
 

Modified: sandbox/logging/boost/logging/logging.hpp
==============================================================================
--- sandbox/logging/boost/logging/logging.hpp (original)
+++ sandbox/logging/boost/logging/logging.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -24,6 +24,7 @@
 #include <boost/logging/detail/fwd.hpp>
 #include <boost/logging/detail/filter.hpp>
 #include <boost/logging/detail/logger.hpp>
+#include <boost/logging/detail/log_keeper.hpp>
 #include <boost/logging/detail/macros.hpp>
 #include <boost/logging/detail/tss/tss.hpp>
 #include <boost/logging/detail/level.hpp>

Modified: sandbox/logging/boost/logging/tags.hpp
==============================================================================
--- sandbox/logging/boost/logging/tags.hpp (original)
+++ sandbox/logging/boost/logging/tags.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -66,7 +66,7 @@
 First of all, note that the easiest way to log some extra context is to simply append it, when definining your macro:
 
 @code
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, debug ) << __FILE__ << ":" << __LINE__ << " [dbg] "
+#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), debug ) << __FILE__ << ":" << __LINE__ << " [dbg] "
 @endcode
 
 In the above case, you appended file & line, and the level of the logged message. Usage is just the same:
@@ -171,14 +171,14 @@
 
 @code
 // add file/line and function tags
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) .set_tag(BOOST_LOG_TAG_FILELINE) .set_tag(BOOST_LOG_TAG_FUNCTION)
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) .set_tag(BOOST_LOG_TAG_FILELINE) .set_tag(BOOST_LOG_TAG_FUNCTION)
 
 // add function and level
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg, g_log_level, debug ) .set_tag(BOOST_LOG_TAG_FUNCTION) .set_tag( BOOST_LOG_TAG_LEVEL(debug) )
+#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_log_dbg(), g_log_level(), debug ) .set_tag(BOOST_LOG_TAG_FUNCTION) .set_tag( BOOST_LOG_TAG_LEVEL(debug) )
 
 // add module information - you specify the module name whe using the L_ macro. Example:
 // L_("chart") << "Initializing environment";
-#define L_(module_name) BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) .set_tag( BOOST_LOG_TAG(module)(module_name) )
+#define L_(module_name) BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) .set_tag( BOOST_LOG_TAG(module)(module_name) )
 
 @endcode
 
@@ -193,16 +193,16 @@
 #include <boost/logging/format/formatter/tags.hpp>
 ...
 
-g_l->writer().add_formatter( formatter::idx() );
-g_l->writer().add_formatter( formatter::append_newline() );
+g_l()->writer().add_formatter( formatter::idx() );
+g_l()->writer().add_formatter( formatter::append_newline() );
 
 // formatters to add the file/line and level
-g_l->writer().add_formatter( formatter::tag::file_line() );
-g_l->writer().add_formatter( formatter::tag::level() );
+g_l()->writer().add_formatter( formatter::tag::file_line() );
+g_l()->writer().add_formatter( formatter::tag::level() );
 
-g_l->writer().add_destination( destination::file("out.txt") );
-g_l->writer().add_destination( destination::cout() );
-g_l->writer().add_destination( destination::dbg_window() );
+g_l()->writer().add_destination( destination::file("out.txt") );
+g_l()->writer().add_destination( destination::cout() );
+g_l()->writer().add_destination( destination::dbg_window() );
 @endcode
 
 Note that the library comes with default formatters for each tag class. However, you can create your own formatter class, for a given tag class.

Modified: sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp
==============================================================================
--- sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp (original)
+++ sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -90,10 +90,10 @@
 typedef gather::ostream_like::return_str<> string;
 
 // not thread-safe
-logger< string, write_to_cout> g_l;
+logger< string, write_to_cout> g_l();
 
 // thread-safe, on dedicated thread
-logger< string, on_dedicated_thread<string,write_to_cout> > g_l;
+logger< string, on_dedicated_thread<string,write_to_cout> > g_l();
 @endcode
 
 You should note that a @b writer is not necessary a %logger. It can be a destination, for instance. For example, you might have a destination
@@ -113,7 +113,6 @@
 
     typedef boost::logging::threading::mutex::scoped_lock scoped_lock;
 
- on_dedicated_thread() {}
     BOOST_LOGGING_FORWARD_CONSTRUCTOR(on_dedicated_thread,base_type)
 
     /**

Modified: sandbox/logging/boost/logging/writer/ts_write.hpp
==============================================================================
--- sandbox/logging/boost/logging/writer/ts_write.hpp (original)
+++ sandbox/logging/boost/logging/writer/ts_write.hpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -45,21 +45,21 @@
 
 @code
 // not thread-safe
-logger< gather::ostream_like::return_str<>, write_to_cout> g_l;
+logger< gather::ostream_like::return_str<>, write_to_cout> g_l();
 
 // thread-safe
-logger< gather::ostream_like::return_str<>, ts_write<write_to_cout> > g_l;
+logger< gather::ostream_like::return_str<>, ts_write<write_to_cout> > g_l();
 
 
 // not thread-safe
 logger<
     gather::ostream_like::return_cache_str<> ,
- format_write< format_base, destination_base> > g_l;
+ format_write< format_base, destination_base> > g_l();
 
 // thread-safe
 logger<
     gather::ostream_like::return_cache_str<> ,
- ts_write< format_write< format_base, destination_base > > > g_l;
+ ts_write< format_write< format_base, destination_base > > > g_l();
 @endcode
 
 Depending on your scenario, you could prefer on_dedicated_thread class.
@@ -69,7 +69,6 @@
     template<class base_type> struct ts_write : base_type, ::boost::logging::manipulator::non_const_context<detail::ts_write_context> {
         typedef ::boost::logging::manipulator::non_const_context<detail::ts_write_context> non_const_context_base;
 
- ts_write() {}
         BOOST_LOGGING_FORWARD_CONSTRUCTOR(ts_write,base_type)
 
         template<class msg_type> void operator()(msg_type msg) const {

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-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -328,6 +328,14 @@
                         <File
                                 RelativePath=".\test_now.cpp"
>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
                         </File>
                 </Filter>
                 <Filter
@@ -858,7 +866,6 @@
>
                                 <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-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -50,7 +50,7 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 
 // Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
@@ -65,11 +65,11 @@
     // 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_newline_if_needed() );
- g_l->writer().add_destination( destination::file("out.txt") );
- g_l->writer().add_destination( destination::cout() );
- g_l->writer().add_destination( destination::dbg_window() );
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
+ g_l()->writer().add_formatter( formatter::append_newline_if_needed() );
+ g_l()->writer().add_destination( destination::file("out.txt") );
+ g_l()->writer().add_destination( destination::cout() );
+ g_l()->writer().add_destination( destination::dbg_window() );
 
 
     destination::rolling_file_settings settings;
@@ -78,9 +78,9 @@
         .max_size_bytes( 5242880 )
         .flush_each_time(true);
     destination::rolling_file loggerFile( "test.txt", settings );
- g_l->writer().add_destination( loggerFile );
+ g_l()->writer().add_destination( loggerFile );
 
- g_l->turn_cache_off();
+ g_l()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;
@@ -90,11 +90,11 @@
     std::string hello = "hello", world = "world";
     L_ << hello << ", " << world;
 
- g_log_filter->set_enabled(false);
+ 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);
+ g_log_filter()->set_enabled(true);
     L_ << "good to be back ;) " << i++;
 
     // Step 9 : Enjoy!

Modified: sandbox/logging/lib/logging/samples/scenarios/cache_before_init.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/cache_before_init.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/cache_before_init.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -78,9 +78,9 @@
 BOOST_DECLARE_LOG(g_log_app, log_type)
 BOOST_DECLARE_LOG(g_log_dbg, log_type)
 
-#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] "
+#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] "
 
 BOOST_DEFINE_LOG_FILTER(g_log_level, boost::logging::level::holder )
 BOOST_DEFINE_LOG(g_log_err, log_type)
@@ -108,37 +108,37 @@
 
 void init_logs() {
     // 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") );
+ 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") );
 
     destination::file out("out.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( out );
- g_log_app->writer().add_destination( destination::cout() );
+ 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( out );
+ 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( out );
- g_log_dbg->writer().add_destination( destination::dbg_window() );
+ 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( out );
+ g_log_dbg()->writer().add_destination( destination::dbg_window() );
 
     // if you change this, you'll get a different output (more or less verbose)
- g_log_level->set_enabled(level::info);
+ g_log_level()->set_enabled(level::info);
 
- g_log_err->turn_cache_off();
- g_log_app->turn_cache_off();
- g_log_dbg->turn_cache_off();
+ g_log_err()->turn_cache_off();
+ g_log_app()->turn_cache_off();
+ g_log_dbg()->turn_cache_off();
 }
 
 void cache_before_init_example() {
     init_logs();
     int i = 10;
     LAPP_ << "after logs have been initialized " << i++;
- g_log_level->set_enabled(level::debug);
+ g_log_level()->set_enabled(level::debug);
     LDBG_ << "some debug message after logs have been initialized " << i++;
 }
 

Modified: sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -74,7 +74,7 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 
 // Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG(g_l, log_type)
@@ -115,14 +115,14 @@
     // 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_newline() );
- 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") );
- g_l->turn_cache_off();
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
+ g_l()->writer().add_formatter( formatter::append_newline() );
+ 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") );
+ g_l()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;
@@ -132,11 +132,11 @@
     std::string hello = "hello", world = "world";
     L_ << hello << ", " << world;
 
- g_log_filter->set_enabled(false);
+ 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);
+ g_log_filter()->set_enabled(true);
     L_ << "good to be back ;) " << i++;
 
     // Step 9 : Enjoy!

Modified: sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -75,7 +75,7 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 
 // Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
@@ -108,12 +108,12 @@
     // 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::time("$mm:$ss ") );
- g_l->writer().add_formatter( formatter::append_newline() );
- g_l->writer().add_destination( destination::file("out.txt") );
- g_l->writer().add_destination( destination::dbg_window() );
- g_l->turn_cache_off();
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
+ g_l()->writer().add_formatter( formatter::time("$mm:$ss ") );
+ g_l()->writer().add_formatter( formatter::append_newline() );
+ g_l()->writer().add_destination( destination::file("out.txt") );
+ g_l()->writer().add_destination( destination::dbg_window() );
+ g_l()->turn_cache_off();
 
     for ( int i = 0 ; i < 5; ++i)
         boost::thread t( &use_log_thread);

Modified: sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -63,12 +63,12 @@
 // FIXME most likely I can use BOOST_LOG_USE_IF_FILTER
 
 // 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() )
+#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() {
- g_log_app->turn_cache_off();
- g_log_err->turn_cache_off();
+ g_log_app()->turn_cache_off();
+ g_log_err()->turn_cache_off();
 
     // Step 5: use it...
     LAPP_("this is so cool\n");
@@ -77,12 +77,12 @@
     std::string hello = "hello", world = "world";
     LAPP_(hello + ", " + world + "\n");
 
- g_log_filter->set_enabled(false);
+ 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);
+ g_log_filter()->set_enabled(true);
     LAPP_("good to be back ;) \n" );
     LERR_("second error \n" );
 

Modified: sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -54,12 +54,12 @@
 BOOST_DEFINE_LOG_WITH_ARGS( g_log_err, err_log_type, ("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() )
+#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() {
- g_log_app->turn_cache_off();
- g_log_err->turn_cache_off();
+ g_log_app()->turn_cache_off();
+ g_log_err()->turn_cache_off();
 
     // Step 5: use it...
     int i = 1;
@@ -70,12 +70,12 @@
     std::string hello = "hello", world = "world";
     LAPP_ << hello << ", " << world << "\n";
 
- g_log_filter->set_enabled(false);
+ 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);
+ g_log_filter()->set_enabled(true);
     LAPP_ << "good to be back ;) " << i++ << "\n";
     LERR_ << "second error " << i++ << "\n";
 

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-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -77,9 +77,10 @@
 BOOST_DECLARE_LOG(g_log_dbg, log_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] "
+#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 )
@@ -94,27 +95,27 @@
     // 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_newline() );
- g_log_err->writer().add_destination( destination::file("err.txt") );
+ 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") );
 
     destination::file out("out.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( out );
- g_log_app->writer().add_destination( destination::cout() );
+ 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( out );
+ 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( out );
- g_log_dbg->writer().add_destination( destination::dbg_window() );
-
- g_log_app->turn_cache_off();
- g_log_err->turn_cache_off();
- g_log_dbg->turn_cache_off();
+ 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( out );
+ g_log_dbg()->writer().add_destination( destination::dbg_window() );
+
+ g_log_app()->turn_cache_off();
+ g_log_err()->turn_cache_off();
+ g_log_dbg()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;
@@ -125,11 +126,11 @@
     std::string hello = "hello", world = "world";
     LAPP_ << hello << ", " << world;
 
- g_log_level->set_enabled(level::error);
+ g_log_level()->set_enabled(level::error);
     LDBG_ << "this will not be written anywhere";
     LAPP_ << "this won't be written anywhere either";
 
- g_log_level->set_enabled(level::info);
+ g_log_level()->set_enabled(level::info);
     LAPP_ << "good to be back ;) " << i++;
     LERR_ << "second error " << i++;
 

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-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -41,9 +41,9 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 
 // Step 5: define the macros through which you'll log
-#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, debug )
-#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, error )
-#define LAPP_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l, g_log_level, info )
+#define LDBG_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), debug )
+#define LERR_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), error )
+#define LAPP_ BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), info )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_level, level::holder ) // holds the application log level
@@ -53,19 +53,19 @@
 void test_mul_levels_one_logger() {
     // Step 7: add formatters and destinations
     // That is, how the message is to be formatted...
- g_l->writer().add_formatter( formatter::idx(), "[%] " );
- //g_l->writer().add_formatter( formatter::high_precision_time("$hh:$mm:$ss.$mili ") );
- g_l->writer().add_formatter( formatter::append_newline() );
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
+ //g_l()->writer().add_formatter( formatter::high_precision_time("$hh:$mm:$ss.$mili ") );
+ g_l()->writer().add_formatter( formatter::append_newline() );
 
     // ... and where should it be written to
- g_l->writer().add_destination(
+ g_l()->writer().add_destination(
         destination::named("cout debug out")
             .add( "cout", destination::cout())
             .add( "out", destination::file("out.txt"))
             .add( "debug", destination::dbg_window() )
          );
 
- g_l->turn_cache_off();
+ g_l()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;
@@ -75,12 +75,12 @@
     std::string hello = "hello", world = "world";
     LAPP_ << hello << ", " << world;
 
- g_log_level->set_enabled(level::error);
+ 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);
+ g_log_level()->set_enabled(level::info);
     LAPP_ << "good to be back ;) " << i++;
     LERR_ << "third error " << i++;
 

Modified: sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -76,9 +76,9 @@
 BOOST_DECLARE_LOG(g_log_dbg, log_type)
 
 // Step 5: 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] "
+#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] "
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
@@ -91,26 +91,26 @@
     // 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_newline() );
- g_log_err->writer().add_destination( destination::file("err.txt") );
+ 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() );
+ 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->turn_cache_off();
- g_log_err->turn_cache_off();
- g_log_dbg->turn_cache_off();
+ 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()->turn_cache_off();
+ g_log_err()->turn_cache_off();
+ g_log_dbg()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;
@@ -121,12 +121,12 @@
     std::string hello = "hello", world = "world";
     LAPP_ << hello << ", " << world;
 
- g_log_filter->set_enabled(false);
+ 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);
+ g_log_filter()->set_enabled(true);
     LAPP_ << "good to be back ;) " << i++;
     LERR_ << "second error " << i++;
 

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 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -69,7 +69,7 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 
 // Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
@@ -78,17 +78,17 @@
 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(), "[%] " );
- g_l->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
- g_l->writer().add_formatter( formatter::append_newline() );
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
+ g_l()->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
+ g_l()->writer().add_formatter( formatter::append_newline() );
 
     // ... and where should it be written to
- g_l->writer().add_destination( destination::cout() );
- g_l->writer().add_destination( destination::dbg_window() );
- g_l->writer().add_destination( destination::file("out.txt") );
+ g_l()->writer().add_destination( destination::cout() );
+ g_l()->writer().add_destination( destination::dbg_window() );
+ g_l()->writer().add_destination( destination::file("out.txt") );
 
     // Now, specify the route
- g_l->writer().router().set_route()
+ g_l()->writer().router().set_route()
         .fmt( formatter::time("$hh:$mm.$ss ") )
         .fmt( formatter::append_newline() )
         .fmt( formatter::idx() )
@@ -106,7 +106,7 @@
         .fmt( formatter::append_newline() )
         .dest( destination::file("out.txt") );
 
- g_l->turn_cache_off();
+ g_l()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;
@@ -115,11 +115,11 @@
     std::string hello = "hello", world = "world";
     L_ << hello << ", " << world;
 
- g_log_filter->set_enabled(false);
+ g_log_filter()->set_enabled(false);
     L_ << "this will not be written anywhere";
     L_ << "this won't be written anywhere either";
 
- g_log_filter->set_enabled(true);
+ g_log_filter()->set_enabled(true);
     L_ << "good to be back ;) " << i++;
 
     // Step 9 : Enjoy!

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-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -49,7 +49,7 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 
 // Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
@@ -60,13 +60,13 @@
     // 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_newline_if_needed() );
- g_l->writer().add_destination( destination::file("out.txt") );
- g_l->writer().add_destination( destination::cout() );
- g_l->writer().add_destination( destination::dbg_window() );
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
+ g_l()->writer().add_formatter( formatter::append_newline_if_needed() );
+ g_l()->writer().add_destination( destination::file("out.txt") );
+ g_l()->writer().add_destination( destination::cout() );
+ g_l()->writer().add_destination( destination::dbg_window() );
 
- g_l->turn_cache_off();
+ g_l()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;
@@ -76,11 +76,11 @@
     std::string hello = "hello", world = "world";
     L_ << hello << ", " << world;
 
- g_log_filter->set_enabled(false);
+ 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);
+ g_log_filter()->set_enabled(true);
     L_ << "good to be back ;) " << i++;
 
     // Step 9 : Enjoy!

Modified: sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -67,7 +67,7 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 
 // Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
@@ -100,13 +100,13 @@
     // 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::thread_id(), "[T%] " );
- g_l->writer().add_formatter( formatter::append_newline() );
- g_l->writer().add_destination( destination::file("out.txt") );
- g_l->writer().add_destination( destination::cout() );
- g_l->writer().add_destination( destination::dbg_window() );
- g_l->turn_cache_off();
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
+ g_l()->writer().add_formatter( formatter::thread_id(), "[T%] " );
+ g_l()->writer().add_formatter( formatter::append_newline() );
+ g_l()->writer().add_destination( destination::file("out.txt") );
+ g_l()->writer().add_destination( destination::cout() );
+ g_l()->writer().add_destination( destination::dbg_window() );
+ g_l()->turn_cache_off();
 
     for ( int i = 0 ; i < 5; ++i)
         boost::thread t( &use_log_thread);

Modified: sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -54,7 +54,7 @@
 BOOST_DECLARE_LOG(g_l, log_type)
 
 // Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
@@ -65,11 +65,11 @@
     // 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_newline_if_needed() );
- g_l->writer().add_destination( destination::cout() );
- g_l->writer().add_destination( destination::dbg_window() );
- g_l->turn_cache_off();
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
+ g_l()->writer().add_formatter( formatter::append_newline_if_needed() );
+ g_l()->writer().add_destination( destination::cout() );
+ g_l()->writer().add_destination( destination::dbg_window() );
+ g_l()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;

Modified: sandbox/logging/lib/logging/samples/scenarios/using_tags.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/using_tags.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/using_tags.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -60,7 +60,7 @@
 BOOST_DECLARE_LOG(g_l, finder::logger)
 
 // Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) .set_tag( BOOST_LOG_TAG_FILELINE)
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) .set_tag( BOOST_LOG_TAG_FILELINE)
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, finder::filter )
@@ -71,16 +71,16 @@
     // 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::named_spacer( "%fileline% [T%thread_id%] [%idx%] %time%" )
+ g_l()->writer().add_formatter( formatter::named_spacer( "%fileline% [T%thread_id%] [%idx%] %time%" )
         .add( "time", formatter::tag::time("$mm:$ss ") ) // time tag
         .add( "idx", formatter::idx() )
         .add( "thread_id", formatter::tag::thread_id() ) // thread_id tag
         .add( "fileline", formatter::tag::file_line() ) ); // file/line tag
 
- g_l->writer().add_formatter( formatter::append_newline() );
- g_l->writer().add_destination( destination::cout() );
- g_l->writer().add_destination( destination::file("out.txt") );
- g_l->turn_cache_off();
+ g_l()->writer().add_formatter( formatter::append_newline() );
+ g_l()->writer().add_destination( destination::cout() );
+ g_l()->writer().add_destination( destination::file("out.txt") );
+ g_l()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;

Modified: sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp 2008-01-17 01:13:23 EST (Thu, 17 Jan 2008)
@@ -91,9 +91,9 @@
 BOOST_DECLARE_LOG(g_log_dbg, finder::logger )
 
 // Step 5: define the macros through which you'll log
-#define LDBG_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_dbg, g_log_filter->is_enabled() )
-#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() )
+#define LDBG_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_dbg(), g_log_filter()->is_enabled() )
+#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() )
 
 // Step 6: Define the filters and loggers you'll use (usually in a source file)
 BOOST_DEFINE_LOG_FILTER(g_log_filter, finder::filter )
@@ -119,25 +119,25 @@
     // 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_newline() );
- g_log_err->writer().add_destination( destination::file("err.txt") );
+ 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() );
+ 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->turn_cache_off();
- g_log_err->turn_cache_off();
- g_log_dbg->turn_cache_off();
+ 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()->turn_cache_off();
+ g_log_err()->turn_cache_off();
+ g_log_dbg()->turn_cache_off();
 
     // Step 8: use it...
     int i = 1;
@@ -148,12 +148,12 @@
     std::string hello = "hello", world = "world";
     LAPP_ << hello << ", " << world;
 
- g_log_filter->set_enabled(false);
+ 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);
+ g_log_filter()->set_enabled(true);
     LAPP_ << "good to be back ;) " << i++;
     LERR_ << "second error " << i++;
 


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