|
Boost-Commit : |
From: john.groups_at_[hidden]
Date: 2008-01-18 10:44:39
Author: jtorjo
Date: 2008-01-18 10:44:38 EST (Fri, 18 Jan 2008)
New Revision: 42844
URL: http://svn.boost.org/trac/boost/changeset/42844
Log:
[logging]
v0.20.5, 18 jan 2008
- handle using logger after it's been destroyed (partially)
- simpler version of logger (derive from logger_base)
Added:
sandbox/logging/boost/logging/detail/after_being_destroyed.hpp (contents, props changed)
sandbox/logging/boost/logging/detail/logger_base.hpp (contents, props changed)
Removed:
sandbox/logging/lib/logging/tests/test_after_destroyed/
Properties modified:
sandbox/logging/lib/logging/samples/compile_time/ (props changed)
sandbox/logging/lib/logging/tests/ (props changed)
sandbox/logging/lib/logging/tests/test_file/ (props changed)
sandbox/logging/lib/logging/tests/test_named/ (props changed)
sandbox/logging/lib/logging/tests/test_named_spacer/ (props changed)
sandbox/logging/lib/logging/tests/test_rolling_file/ (props changed)
sandbox/logging/lib/logging/tests/test_simple_tss/ (props changed)
sandbox/logging/lib/logging/tests/test_tags/ (props changed)
Text files modified:
sandbox/logging/boost/logging/detail/cache_before_init.hpp | 14 ++--
sandbox/logging/boost/logging/detail/cache_before_init_macros.hpp | 4 +
sandbox/logging/boost/logging/detail/log_keeper.hpp | 16 +++--
sandbox/logging/boost/logging/detail/logger.hpp | 106 +++++++++++++--------------------------
sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 4 +
sandbox/logging/boost/logging/detail/raw_doc/todo.hpp | 4 -
sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 17 ++++++
sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 33 -----------
8 files changed, 77 insertions(+), 121 deletions(-)
Added: sandbox/logging/boost/logging/detail/after_being_destroyed.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/after_being_destroyed.hpp 2008-01-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -0,0 +1,96 @@
+// after_being_destroyed.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+#ifndef JT28092007_after_being_destroyed_HPP_DEFINED
+#define JT28092007_after_being_destroyed_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+#if !defined(BOOST_LOG_AFTER_BEING_DESTROYED_WRITE_TO_FUNCTION) && !defined(BOOST_LOG_AFTER_BEING_DESTROYED_IGNORE) && !defined(BOOST_LOG_AFTER_BEING_DESTROYED_LEAK_LOGGER)
+ // default
+ #define BOOST_LOG_AFTER_BEING_DESTROYED_WRITE_TO_FUNCTION
+#endif
+
+
+
+
+/**
+ @file boost/logging/detail/after_being_destoyed.hpp
+
+ This file deals with the following situation:
+ - what happens when someone is using the log(s) after they've been destroyed?
+*/
+
+namespace boost { namespace logging {
+
+namespace destination { template<class T > struct msg_type; }
+
+ /**
+ deals with what to do with the logger, if used after it's been destroyed
+
+ @remarks
+ we need to make this a template, in order to postpone figuring out the gather_msg msg_type
+ (so that we can wait until the user has specified the msg_type
+
+ */
+ template<class T = override> struct after_being_destroyed_defer_to_function {
+ typedef typename destination::msg_type<T>::raw_type raw_type;
+ typedef void (*after_destroyed_func)(const raw_type&) ;
+
+ // default implementation - do nothing
+ static void nothing(const raw_type&) {}
+
+ bool is_still_alive() const { return !m_is_destroyed; }
+ void call_after_destroyed(const raw_type& msg) const {
+ m_after_being_destroyed(msg);
+ }
+
+ protected:
+ after_being_destroyed_defer_to_function () : m_is_destroyed(false), m_after_being_destroyed(¬hing) {}
+ ~after_being_destroyed_defer_to_function () {
+ m_is_destroyed = true;
+ }
+ private:
+ bool m_is_destroyed;
+ after_destroyed_func m_after_being_destroyed;
+ };
+
+ template<class T = override> struct after_being_destroyed_none {
+ static bool is_still_alive() { return true; }
+ // never called
+ template<class type> void call_after_destroyed(const type&) const {}
+ };
+
+ template<class T = override> struct after_being_destroyed
+#ifdef BOOST_LOG_AFTER_BEING_DESTROYED_WRITE_TO_FUNCTION
+ : public after_being_destroyed_defer_to_function<T>
+#elif defined(BOOST_LOG_AFTER_BEING_DESTROYED_IGNORE)
+ // ignore
+ : public after_being_destroyed_none<T>
+#elif defined(BOOST_LOG_AFTER_BEING_DESTROYED_LEAK_LOGGER)
+ // leaking, ignore this
+ : public after_being_destroyed_none<T>
+#endif
+ {};
+
+}}
+
+#endif
+
Modified: sandbox/logging/boost/logging/detail/cache_before_init.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/cache_before_init.hpp (original)
+++ sandbox/logging/boost/logging/detail/cache_before_init.hpp 2008-01-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -99,21 +99,21 @@
bool is_using_cache;
};
public:
- bool is_cache_turned_on() const {
+ bool is_cache_turned_off() const {
{
typename is_cache_enabled_data::read info(m_is_caching_off);
bool is_caching_off = info.use();
if ( is_caching_off)
- return false; // cache has been turned on
+ return true; // cache has been turned on
}
// now we go the slow way - use mutex to see if cache is turned off
mutex::scoped_lock lk(m_cs);
- return (m_cache.is_using_cache);
+ return !(m_cache.is_using_cache);
}
template<class writer_type> void turn_cache_off(const writer_type & writer) {
- if ( !is_cache_turned_on() )
+ if ( is_cache_turned_off() )
return; // already turned off
{
@@ -144,10 +144,10 @@
// called after all data has been gathered
template<class writer_type> void on_do_write(msg_type & msg, const writer_type & writer) const {
- if ( is_cache_turned_on() )
- add_msg(msg);
- else
+ if ( is_cache_turned_off() )
writer(msg);
+ else
+ add_msg(msg);
}
protected:
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-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -55,7 +55,9 @@
set_callback_if_needed(); \
} \
void set_callback_if_needed() { \
- if ( ::boost::logging::get_logger_base( l )->cache().is_cache_turned_on() ) \
+ if ( ::boost::logging::get_logger_base( l )->is_cache_turned_off() ) \
+ ; \
+ else \
::boost::logging::get_logger_base( l )->cache().set_callback( &is_enabled_callback ); \
} \
} param = ( !(is_log_enabled) ) ? (void*)0 : ::boost::logging::get_logger_base( l )-> do_func
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-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -41,7 +41,7 @@
*/
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;
+ typedef logger<gather_type> logger_base_type;
BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW_AND_INIT(log_holder, m_log, type, init)
~log_holder() {
@@ -61,8 +61,8 @@
type* get() { return m_log; }
- const logger_base * base() const { return m_base; }
- logger_base * base() { return m_base; }
+ const logger_base_type * base() const { return m_base; }
+ logger_base_type * base() { return m_base; }
private:
void init() {
@@ -72,7 +72,7 @@
}
private:
type * m_log;
- logger_base * m_base;
+ logger_base_type * m_base;
};
/**
@@ -117,8 +117,12 @@
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; }
-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(); }
+template<class type, class gather_msg> inline typename log_holder<type,gather_msg>::logger_base_type* 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_type* 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-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -26,6 +26,7 @@
#include <boost/logging/detail/find_gather.hpp>
#include <boost/logging/detail/cache_before_init.hpp>
#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/logging/detail/logger_base.hpp>
namespace boost { namespace logging {
@@ -41,7 +42,7 @@
~gather_holder() {
// FIXME handle exiting from exceptions!!!
if ( m_use)
- m_this.on_do_write(m_obj);
+ m_this.on_do_write( detail::as_non_const(gather().msg()) );
}
gather_type & gather() { return m_obj; }
private:
@@ -50,31 +51,6 @@
mutable bool m_use;
};
- namespace detail {
- template<class type> type& as_non_const(const type & t) { return const_cast<type&>(t); }
-
- template<class gather_msg> struct find_gather_if_default {
- typedef typename use_default<gather_msg,
- gather::ostream_like::return_str< std::basic_string<char_type>, std::basic_ostringstream<char_type> > > ::type gather_type;
- typedef typename gather_type::msg_type msg_type;
- };
-
- /**
- @brief default implementation of keeping cache
-
- (note : you can override the cache() functions, to implement your own cache keeping strategy)
- */
- template<class cache_type> struct default_cache_keeper {
- /** note: this call does not need to be very efficient, since the cache is used seldom,
- only at the beginning of the app, when the logging hasn't yet been initialized
- thus, we can afford to make it virtual, and the code will become easier
- */
- virtual cache_type & cache() { return m_cache; }
- virtual const cache_type & cache() const { return m_cache; }
- private:
- cache_type m_cache;
- };
- }
@@ -136,16 +112,15 @@
// 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 > > {
+ template<class gather_msg> struct logger<gather_msg, default_ > : logger_base<gather_msg, default_> {
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 typename gather_type::msg_type msg_type;
typedef void_ write_type;
- typedef detail::default_cache_keeper<cache_type> cache_base;
- using cache_base::cache;
+
+ typedef logger_base<gather_msg, default_> logger_base_type;
+ using logger_base_type::cache;
typedef logger<gather_msg, default_> self;
- typedef typename gather_type::msg_type msg_type;
logger() {}
// we have virtual functions, lets have a virtual destructor as well - many thanks Martin Baeker!
@@ -162,9 +137,6 @@
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;
@@ -175,8 +147,11 @@
};
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) );
+ void on_do_write(msg_type & msg) const {
+ if ( logger_base_type::is_still_alive() )
+ cache().on_do_write( msg, call_do_write(*this) );
+ else
+ logger_base_type::call_after_destroyed(msg);
}
void turn_cache_off() {
cache().turn_cache_off( call_do_write(*this) );
@@ -200,8 +175,9 @@
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;
+ typedef typename log_base::cache_type cache_type;
+
// ... might be called for a specialization of logger - for logger<gather_msg,write_msg*>
typedef typename boost::remove_pointer<write_msg>::type write_type;
@@ -234,14 +210,12 @@
// 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 > > {
+ template<class gather_msg , class write_msg > struct logger : logger_base<gather_msg, write_msg> {
typedef typename detail::find_gather_if_default<gather_msg>::gather_type gather_type;
+ typedef typename gather_type::msg_type msg_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 logger_base<gather_msg, write_msg> logger_base_type;
+ using logger_base_type::cache;
typedef logger<gather_msg, write_msg> self;
@@ -260,16 +234,12 @@
write_msg & writer() { return m_writer; }
const write_msg & writer() const { return m_writer; }
- /**
- ... 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_type & gather) const {
- cache().on_do_write( detail::as_non_const(gather.msg()), writer() );
+ void on_do_write(msg_type & msg) const {
+ if ( logger_base_type::is_still_alive() )
+ cache().on_do_write( msg, writer() );
+ else
+ logger_base_type::call_after_destroyed(msg);
}
void turn_cache_off() {
cache().turn_cache_off( writer() );
@@ -277,7 +247,7 @@
private:
void init() {
- m_base.forward_to(this);
+ logger_base_type::m_base.forward_to(this);
}
private:
@@ -287,19 +257,19 @@
};
// 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 > > {
+ template<class gather_msg, class write_msg> struct logger<gather_msg, write_msg* > : logger_base<gather_msg, write_msg* > {
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 detail::default_cache_keeper<cache_type> cache_base;
- typedef logger<gather_type> logger_base_type;
- using cache_base::cache;
+ typedef typename gather_type::msg_type msg_type;
typedef write_msg write_type;
+ typedef logger_base<gather_msg, write_msg* > logger_base_type;
+ using logger_base_type::cache;
+
+
typedef logger<gather_msg, write_msg*> self;
logger(write_msg * writer = 0) : m_writer(writer) {
- m_base.forward_to(this);
+ logger_base_type::m_base.forward_to(this);
}
~logger() {
// force writing all messages from cache, if cache hasn't been turned off yet
@@ -318,16 +288,12 @@
write_msg & writer() { return *m_writer; }
const write_msg & writer() const { return *m_writer; }
- /**
- ... 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; }
-
// 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()), writer() );
+ void on_do_write(msg_type & msg) const {
+ if ( logger_base_type::is_still_alive() )
+ cache().on_do_write( msg, writer() );
+ else
+ logger_base_type::call_after_destroyed(msg);
}
void turn_cache_off() {
cache().turn_cache_off( writer() );
Added: sandbox/logging/boost/logging/detail/logger_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/logger_base.hpp 2008-01-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -0,0 +1,121 @@
+// logger_base.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+#ifndef JT28092007_logger_base_HPP_DEFINED
+#define JT28092007_logger_base_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <boost/logging/detail/after_being_destroyed.hpp>
+
+#ifndef JT28092007_logger_HPP_DEFINED
+#error don't include this directly. include <boost/logging/logging.hpp> instead
+#endif
+
+namespace boost { namespace logging {
+ // forward declare
+ template<class gather_msg , class write_msg > struct logger ;
+ template<class gather_msg, class write_msg> struct forward_to_logger ;
+
+ namespace detail {
+ template<class type> type& as_non_const(const type & t) { return const_cast<type&>(t); }
+
+ template<class gather_msg> struct find_gather_if_default {
+ typedef typename use_default<gather_msg,
+ gather::ostream_like::return_str< std::basic_string<char_type>, std::basic_ostringstream<char_type> > > ::type gather_type;
+ typedef typename gather_type::msg_type msg_type;
+ };
+
+ /**
+ @brief default implementation of keeping cache
+
+ (note : you can override the cache() functions, to implement your own cache keeping strategy)
+ */
+ template<class cache_type> struct default_cache_keeper {
+ default_cache_keeper() : m_is_cache_turned_off(false) {}
+
+ /**
+ I've implemented this as a fast "is turned off" question.
+
+ that is, I want to avoid calling cache().is_cache_turned_off(), since calling cache() involves a virtual call
+ */
+ bool is_cache_turned_off() const {
+ if ( m_is_cache_turned_off)
+ return true;
+
+ return cache().is_cache_turned_off();
+ }
+
+ /** note: this call does not need to be very efficient, since the cache is used seldom,
+ only at the beginning of the app, when the logging hasn't yet been initialized
+ thus, we can afford to make it virtual, and the code will become easier
+ */
+ virtual cache_type & cache() { return m_cache; }
+ virtual const cache_type & cache() const { return m_cache; }
+ private:
+ cache_type m_cache;
+ bool m_is_cache_turned_off;
+ };
+
+ }
+
+
+ namespace detail {
+ template<class gather_msg , class write_msg > struct common_base_holder {
+ typedef typename detail::find_gather_if_default<gather_msg>::gather_type gather_type;
+ typedef logger<gather_type, default_> common_base_type;
+ /**
+ ... 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 common_base_type* common_base() const { return m_base; }
+ common_base_type* common_base() { return m_base; }
+
+ protected:
+ // 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_msg> m_base;
+ };
+
+ // specialize - when write_msg is default, our common base is ourselves
+ template<class gather_msg> struct common_base_holder<gather_msg, default_> {
+ typedef typename detail::find_gather_if_default<gather_msg>::gather_type gather_type;
+ typedef logger<gather_msg, default_> subclass_type;
+
+ const subclass_type* common_base() const { return static_cast<const subclass_type*>(this); }
+ subclass_type* common_base() { return static_cast<subclass_type*>(this); }
+ };
+ }
+
+
+ template<class gather_msg , class write_msg, class dummy = override > struct logger_base
+ : detail::default_cache_keeper< detail::cache_before_init<typename detail::find_gather_if_default<gather_msg>::msg_type > >,
+ detail::common_base_holder<gather_msg, write_msg>,
+ after_being_destroyed<dummy> {
+ 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;
+ using cache_base::cache;
+
+ typedef logger<gather_msg, write_msg> subclass_type;
+
+ };
+
+}}
+
+#endif
+
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-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -1,7 +1,9 @@
/**
@page page_changelog Changelog
-_at_section changelog_cur_ver Current Version: v0.20.4, 17 jan 2008
+@section changelog_cur_ver Current Version: v0.20.5, 18 jan 2008
+- handle using logger after it's been destroyed (partially)
+- simpler version of logger (derive from logger_base)
- added dll_and_exe - show how you can use a logger that is defined in a DLL, and use it from an EXE
- explained the breaking change in the docs
- updated the tests to compile (after the breaking change)
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-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -49,10 +49,6 @@
and see the namespace/class name from there. Or, I could implement it using __FILE__.
- Votes: 1
-- @c high TSS ostringstream: I can have a tss(std::ostringstream), when gathering data if creation of std::ostringstream takes time.
- this does not need to apply to ostringstream only - it should apply to any gather::ostream_like class
- - Votes: 1
-
- @c low have a "class"/"function" filter \n - so basically you can have is_enabled(this), which will call
is_enabled<some_type>, which you can later on, or at runtime, enable or disable.
--> turn on/off based on class name (typeid(name).string() - could be problematic in case the names are cryptic.
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-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -330,7 +330,6 @@
>
<FileConfiguration
Name="Test|Win32"
- ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@@ -398,6 +397,10 @@
Name="headers"
>
<File
+ RelativePath="..\..\..\..\..\boost\logging\detail\after_being_destroyed.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\..\boost\logging\detail\cache_before_init.hpp"
>
</File>
@@ -438,6 +441,10 @@
>
</File>
<File
+ RelativePath="..\..\..\..\..\boost\logging\detail\logger_base.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\..\boost\logging\logging.hpp"
>
</File>
@@ -868,6 +875,14 @@
<File
RelativePath="..\..\..\samples\scenarios\mul_levels_one_logger.cpp"
>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\..\samples\scenarios\mul_loggers_one_filter.cpp"
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-18 10:44:38 EST (Fri, 18 Jan 2008)
@@ -1,34 +1,3 @@
-/**
-_at_example one_loger_one_filter.cpp
-
-_at_copydoc one_loger_one_filter
-
-_at_page one_loger_one_filter one_loger_one_filter.cpp Example
-
-
-This usage:
-- You have one logger
-- You have one filter, which can be turned on or off
-- You want to format the message before it's written
-- The logger has several log destinations
- - The output goes to console, debug output window, and a file called out.txt
- - Formatting - prefix each message by its index, and append newline
-
-Optimizations:
-- use a cache string (from optimize namespace), in order to make formatting the message faster
-
-In this example, all output will be written to the console, debug window, and "out.txt" file.
-It will be:
-
-_at_code
-[1] this is so cool 1
-[2] this is so cool again 2
-[3] hello, world
-[4] good to be back ;) 3
-_at_endcode
-
-*/
-
#define BOOST_LOG_BEFORE_INIT_IGNORE_BEFORE_INIT
#include <boost/logging/format_fwd.hpp>
@@ -62,6 +31,8 @@
}
void one_logger_one_filter_example() {
+ forward_to_logger< default_, destination::cout > l;
+ logger<default_> * ll = l.common_base();
// Step 7: add formatters and destinations
// That is, how the message is to be formatted and where should it be written to
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