|
Boost-Commit : |
From: john.groups_at_[hidden]
Date: 2008-01-04 06:35:28
Author: jtorjo
Date: 2008-01-04 06:35:26 EST (Fri, 04 Jan 2008)
New Revision: 42452
URL: http://svn.boost.org/trac/boost/changeset/42452
Log:
[logging]
v0.13.1, 4 jan 2008
- began implementation of caching messages before initialization of logs
- gather classes now have msg_type instead of param (msg_type contains the type of the returned msg - without const or &)
Added:
sandbox/logging/boost/logging/detail/cache_before_init.hpp (contents, props changed)
sandbox/logging/boost/logging/detail/cache_before_init_macros.hpp (contents, props changed)
Text files modified:
sandbox/logging/boost/logging/detail/fwd.hpp | 3 +--
sandbox/logging/boost/logging/detail/logger.hpp | 16 +++++++---------
sandbox/logging/boost/logging/detail/macros.hpp | 5 ++---
sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 6 +++++-
sandbox/logging/boost/logging/detail/scoped_log.hpp | 3 ---
sandbox/logging/boost/logging/detail/ts/ts_resource.hpp | 2 +-
sandbox/logging/boost/logging/detail/use_format_write.hpp | 6 +-----
sandbox/logging/boost/logging/detail/util.hpp | 7 ++++++-
sandbox/logging/boost/logging/gather/ostream_like.hpp | 24 ++++++++++++++++++++----
sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 17 ++++++++++++++++-
sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 14 +++++++++++++-
sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp | 4 ++--
sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp | 5 +++--
13 files changed, 77 insertions(+), 35 deletions(-)
Added: sandbox/logging/boost/logging/detail/cache_before_init.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/cache_before_init.hpp 2008-01-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -0,0 +1,193 @@
+// cache_before_init.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_cache_before_init_HPP_DEFINED
+#define JT28092007_cache_before_init_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#ifndef JT28092007_logger_HPP_DEFINED
+#error Donot include this directly. Include boost/logging/logging.hpp instead
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <map>
+#include <vector>
+#include <boost/thread/detail/config.hpp>
+#include <boost/assert.hpp>
+
+namespace boost { namespace logging { namespace detail {
+
+// have a cache class!!!!!!!!! log the thread as well
+
+#if defined (BOOST_HAS_WINTHREADS)
+typedef DWORD thread_id_type;
+#elif defined (BOOST_HAS_PTHREADS)
+typedef pthread_t thread_id_type;
+#else
+#error Unknown threading type
+#endif
+
+inline thread_id_type get_thread_id() {
+#if defined (BOOST_HAS_WINTHREADS)
+ return ::GetCurrentThreadId();
+#elif defined (BOOST_HAS_PTHREADS)
+ return pthread_self ();
+#endif
+}
+
+
+#if defined( BOOST_LOG_BEFORE_INIT_USE_CACHE_FILTER) || defined( BOOST_LOG_BEFORE_INIT_USE_LOG_ALL)
+//////////////////////////////////////////////////////////////////
+// Messages that were logged before initializing the log - Caching them
+
+/**
+ The library will make sure your logger derives from this in case you want to cache messages that are logged before logs are initialized.
+
+ Note:
+ - you should initialize your logs ASAP
+ - before logs are initialized, logging each message is done using a mutex .
+ - cache can be turned off ONLY ONCE
+
+
+*/
+template<class msg_type, class lock_resource = ::boost::logging::lock_resource_finder::single_thread > struct cache_before_init {
+private:
+ typedef typename lock_resource::template finder<bool>::type is_cache_enabled_data;
+ typedef bool (*is_enabled_func)();
+
+ struct message {
+ message(is_enabled_func is_enabled, msg_type string) : is_enabled(is_enabled), string(string) {}
+ // function that sees if the filter is enabled or not
+ is_enabled_func is_enabled;
+ // the message itself
+ msg_type string;
+ };
+
+ struct thread_info {
+ thread_info() : last_enabled(0) {}
+ is_enabled_func last_enabled;
+ };
+
+ struct cache {
+ cache() : is_using_cache(true) {}
+
+ typedef std::map<thread_id_type, thread_info> thread_coll;
+ thread_coll threads;
+
+ typedef std::vector<message> message_array;
+ message_array msgs;
+
+ bool is_using_cache;
+ };
+public:
+ bool is_cache_turned_on() 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
+ }
+
+ // 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);
+ }
+
+protected:
+ template<class self_type> void turn_cache_off(self_type & self) {
+ {
+ mutex::scoped_lock lk(m_cs);
+ m_cache.is_using_cache = false;
+ }
+
+ {
+ typename is_cache_enabled_data::write info(m_is_caching_off);
+ info.use() = true;
+ }
+
+ // dump messages
+ cache::message_array msgs;
+ {
+ mutex::scoped_lock lk(m_cs);
+ std::swap( m_cache.msgs, msgs);
+ }
+ for ( cache::message_array::const_iterator b = msgs.begin(), e = msgs.end(); b != e; ++b)
+ if ( b->is_enabled() )
+ self( b->string );
+ }
+
+ // 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
+ writer(msg);
+ }
+
+
+public:
+ void set_callback(is_enabled_func f) {
+ mutex::scoped_lock lk(m_cs);
+ m_cache.threads[ get_thread_id() ].last_enabled = f;
+ }
+
+ void add_msg(const msg_type & msg) {
+ mutex::scoped_lock lk(m_cs);
+ // note : last_enabled can be null, if we don't want to use filters (BOOST_LOG_BEFORE_INIT_USE_LOG_ALL)
+ is_enabled_func func = m_cache.threads[ get_thread_id() ].last_enabled ;
+ m_cache.msgs.push_back( message(func, msg) );
+ }
+
+
+
+
+
+private:
+ mutex m_cs;
+ cache m_cache;
+ /**
+ IMPORTANT: to make sure we know when the cache is off as efficiently as possible, I have this mechanism:
+ - first, query m_is_enabled,which at the beginning is false (this is very efficient, we can use TSS here)
+ - if this is true, it's clear that caching has been turned off
+ - if this is false, we don't know for sure, thus, continue to ask
+
+ - second, use the thread-safe resource 'm_cache' (use a mutex, a bit slow, but that's life)
+ - if m_cache.is_using_cache is true, we're still using cache
+ - if m_cache.is_using_cache is false, caching has been turned off
+ - set m_is_enabled to true, thus this will propagate to all threads soon (depending on your lock_resource)
+ */
+ is_cache_enabled_data m_is_caching_off;
+};
+
+#else
+//////////////////////////////////////////////////////////////////
+// Messages that were logged before initializing the log - NOT Caching them
+
+template<class msg_type, class lock_resource = ::boost::logging::lock_resource_finder::single_thread > struct cache_before_init {
+
+};
+
+#endif
+
+
+
+}}}
+
+#endif
+
Added: sandbox/logging/boost/logging/detail/cache_before_init_macros.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/cache_before_init_macros.hpp 2008-01-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -0,0 +1,87 @@
+// cache_before_init_macros.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_cache_before_init_macros_HPP_DEFINED
+#define JT28092007_cache_before_init_macros_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#ifndef JT28092007_macros_HPP_DEFINED
+#error Donot include this directly. Include boost/logging/macros.hpp instead
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+namespace boost { namespace logging {
+
+#if defined(BOOST_LOG_BEFORE_INIT_CACHE_FILTER)
+ #define BOOST_LOG_BEFORE_INIT_USE_CACHE_FILTER
+#elif defined(BOOST_LOG_BEFORE_INIT_LOG_ALL)
+ #define BOOST_LOG_BEFORE_INIT_USE_LOG_ALL
+#elif defined(BOOST_LOG_BEFORE_INIT_IGNORE_BEFORE_INIT)
+ #define BOOST_LOG_BEFORE_INIT_USE_IGNORE_BEFORE_INIT
+#else
+// use default
+ #define BOOST_LOG_BEFORE_INIT_USE_CACHE_FILTER
+#endif
+
+
+
+
+#if defined( BOOST_LOG_BEFORE_INIT_USE_CACHE_FILTER)
+/////////////////////////////////////////////////////////////////////////////////////////////
+// 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) \
+ struct local_class { \
+ static bool is_enabled_callback() { return (is_log_enabled); } \
+ local_class (const void * p) { \
+ if ( p) \
+ set_callback_if_needed(); \
+ } \
+ void set_callback_if_needed() { \
+ } \
+ } param_name = ( !(is_log_enabled) ) ? (void*)0 : l .base()-> do_func
+
+// if ( l.is_cache_turned_on() ) \
+ // l.set_callback( &is_enabled_callback ); \
+
+#define BOOST_LOG_USE_LOG(l, do_func, is_log_enabled) \
+ BOOST_LOG_USE_LOG_LOCAL_CLASS( l, do_func, is_log_enabled, \
+ BOOST_LOG_CONCATENATE(local_class_,__LINE__), BOOST_LOG_CONCATENATE(param_,__LINE__) )
+
+
+#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)
+
+
+#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
+
+#else
+#error Internal error.
+#endif
+
+}}
+
+#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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -21,16 +21,15 @@
# pragma once
#endif
-#include <boost/logging/detail/fwd.hpp>
#include <time.h>
#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>
#include <boost/logging/detail/ts/ts_resource.hpp>
-#include <boost/logging/detail/util.hpp>
#include <boost/logging/defaults.hpp>
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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -13,7 +13,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
// See http://www.torjo.com/log2/ for more details
-
+// IMPORTANT : the JT28092007_logger_HPP_DEFINED needs to remain constant - don't change the macro name!
#ifndef JT28092007_logger_HPP_DEFINED
#define JT28092007_logger_HPP_DEFINED
@@ -117,10 +117,8 @@
logger() {}
BOOST_LOGGING_FORWARD_CONSTRUCTOR(logger,m_writer)
- // FIXME watch for copy-construction!
/**
reads all data about a log message (gathers all the data about it)
- FIXME
*/
gather_holder<self, gather_type> read_msg() const { return gather_holder<self, gather_type>(*this) ; }
@@ -175,7 +173,7 @@
typedef void_ write_type;
typedef logger<gather_msg, default_> self;
- typedef typename gather_msg::param param;
+ typedef typename gather_msg::msg_type msg_type;
logger() {}
// we have virtual functions, lets have a virtual destructor as well - many thanks Martin Baeker!
@@ -196,7 +194,7 @@
do_write( detail::as_non_const(gather.msg()) );
}
- virtual void do_write(param) const = 0;
+ virtual void do_write(msg_type&) const = 0;
private:
// we don't know the writer
void_ m_writer;
@@ -207,12 +205,12 @@
@param write_msg the write message class. If a pointer, forwards to a pointer. If not a pointer, it holds it by value.
*/
template<class gather_msg, class write_msg> struct implement_default_logger : logger<gather_msg, default_> {
- typedef typename gather_msg::param param;
+ typedef typename gather_msg::msg_type msg_type;
implement_default_logger() {}
BOOST_LOGGING_FORWARD_CONSTRUCTOR(implement_default_logger,m_writer)
- virtual void do_write(param a) const {
+ virtual void do_write(msg_type &a) const {
m_writer(a);
}
@@ -222,7 +220,7 @@
// specialization for pointers
template<class gather_msg, class write_msg> struct implement_default_logger<gather_msg,write_msg*> : logger<gather_msg, default_> {
- typedef typename gather_msg::param param;
+ typedef typename gather_msg::msg_type msg_type;
implement_default_logger(write_msg * writer = 0) : m_writer(writer) {}
@@ -230,7 +228,7 @@
m_writer = writer;
}
- virtual void do_write(param a) const {
+ virtual void do_write(msg_type &a) const {
(*m_writer)(a);
}
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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -28,6 +28,7 @@
#endif
#include <boost/current_function.hpp>
+#include <boost/logging/detail/cache_before_init_macros.hpp>
namespace boost { namespace logging {
@@ -575,14 +576,12 @@
// Log Macros
-#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_IF_LEVEL(l, holder, the_level) BOOST_LOG_USE_LOG(l, read_msg().gather().out(), holder->is_enabled(::boost::logging::level:: the_level) )
#define BOOST_LOG_USE_LOG_IF_FILTER(l, the_filter) BOOST_LOG_USE_LOG(l, read_msg().gather().out(), the_filter)
-#define BOOST_LOG_USE_SIMPLE_LOG_IF_FILTER(l, is_log_enabled) if ( !(is_log_enabled) ) ; else l .base() ->read_msg().gather().out
-
+#define BOOST_LOG_USE_SIMPLE_LOG_IF_FILTER(l, is_log_enabled) BOOST_LOG_USE_LOG(l, read_msg().gather().out, is_log_enabled)
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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -1,7 +1,11 @@
/**
@page page_changelog Changelog
-_at_section changelog_cur_ver Current Version: v0.12.13, 29 dec 2007
+@section changelog_cur_ver Current Version: v0.13.1, 4 jan 2008
+- began implementation of caching messages before initialization of logs
+- gather classes now have msg_type instead of param (msg_type contains the type of the returned msg - without const or &)
+
+v0.12.13, 29 dec 2007
- added tss_ostringstream - allow faster creation of stringstreams (one stringstream per thread)
- added destination::named - similar to formatter::named_spacer, but for destinations
- added possibility to flush a rolling file, and fixed a bug
Modified: sandbox/logging/boost/logging/detail/scoped_log.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/scoped_log.hpp (original)
+++ sandbox/logging/boost/logging/detail/scoped_log.hpp 2008-01-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -26,9 +26,6 @@
namespace boost { namespace logging {
-#define BOOST_LOG_CONCATENATE2(a,b) a ## b
-
-#define BOOST_LOG_CONCATENATE(a,b) BOOST_LOG_CONCATENATE2(a,b)
#ifndef BOOST_LOG_USE_WCHAR_T
Modified: sandbox/logging/boost/logging/detail/ts/ts_resource.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/ts/ts_resource.hpp (original)
+++ sandbox/logging/boost/logging/detail/ts/ts_resource.hpp 2008-01-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -160,7 +160,7 @@
struct value_and_time {
value_and_time()
// so that the first time it's used, it'll be refreshed
- : time_(0) {
+ : val( type() ), time_(0) {
}
type val;
::time_t time_;
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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -29,8 +29,6 @@
#include <boost/logging/gather/ostream_like.hpp>
#include <boost/logging/detail/manipulator.hpp>
#include <boost/logging/detail/find_gather.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace logging {
@@ -74,9 +72,7 @@
};
template<class gather_type, class format_write> struct find_writer_with_thread_safety<boost::logging::writer::threading::on_dedicated_thread,gather_type,format_write> {
- typedef typename gather_type::param param;
- typedef typename boost::remove_reference<param>::type param_no_ref;
- typedef typename boost::remove_const<param_no_ref>::type msg_type;
+ typedef typename gather_type::msg_type msg_type;
typedef writer::on_dedicated_thread<msg_type, format_write> 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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -29,7 +29,6 @@
*/
namespace boost { namespace logging {
- template<class type> struct type_as_arg {};
struct default_ {};
@@ -49,5 +48,11 @@
}}
+
+#define BOOST_LOG_CONCATENATE2(a,b) a ## b
+
+#define BOOST_LOG_CONCATENATE(a,b) BOOST_LOG_CONCATENATE2(a,b)
+
+
#endif
Modified: sandbox/logging/boost/logging/gather/ostream_like.hpp
==============================================================================
--- sandbox/logging/boost/logging/gather/ostream_like.hpp (original)
+++ sandbox/logging/boost/logging/gather/ostream_like.hpp 2008-01-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -65,6 +65,19 @@
*/
namespace gather {
+/**
+ @brief In case your gather class returns anything else than a std::basic_ostream, that returned class @b must derive from this.
+
+ This is needed when :
+ - in your application, you could have messages logged before your logs are initialized
+ - you want filters to work even "in advance" - that is, if a message was logged before your log was initialized,
+ and when you initialize the log, its corresponding filter is turned on, that message will be logged.
+ Otherwise, it will @b not be logged.
+*/
+struct out_base {
+ operator const void*() const { return this; }
+};
+
/**
@brief Gathering the message: Allows you to write to a log using the cool "<<" operator.
@@ -90,7 +103,8 @@
*/
template<class stream_type = std::basic_ostringstream<char_type> > struct return_raw_stream {
// what does the gather_msg class return?
- typedef stream_type& param;
+// typedef stream_type& param;
+ typedef stream_type msg_type;
return_raw_stream() {}
return_raw_stream(const return_raw_stream& other) : m_out( other.m_out.str() ) {}
@@ -127,7 +141,8 @@
class stream_type = std::basic_ostringstream<char_type> > struct return_str {
// what does the gather_msg class return?
- typedef string & param;
+// typedef string & param;
+ typedef string msg_type;
return_str() {}
return_str(const return_str& other) : m_out(other.m_out.str()) {}
@@ -146,9 +161,10 @@
See @ref boost::logging::tag namespace
*/
-template<class holder_type, class stream_type> struct return_tag_holder {
+ template<class holder_type, class stream_type> struct return_tag_holder : out_base {
// what does the gather_msg class return?
- typedef holder_type& param;
+// typedef holder_type& param;
+ typedef holder_type msg_type;
return_tag_holder() {}
return_tag_holder(const return_tag_holder& other) : m_out(other.m_out.str()), m_val(other.m_val) {}
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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -330,7 +330,6 @@
>
<FileConfiguration
Name="Test|Win32"
- ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@@ -398,6 +397,14 @@
Name="headers"
>
<File
+ RelativePath="..\..\..\..\..\boost\logging\detail\cache_before_init.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\cache_before_init_macros.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\..\boost\logging\defaults.hpp"
>
</File>
@@ -896,6 +903,14 @@
<File
RelativePath="..\..\..\samples\scenarios\use_tss_ostringstream.cpp"
>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\..\samples\scenarios\using_tags.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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -90,8 +90,20 @@
// Step 8: use it...
int i = 1;
+#if 0
+ struct local_class {
+ static bool is_enabled_callback() { return (g_log_filter->is_enabled()); }
+ local_class (const void * p) {
+ if ( p)
+ set_callback_if_needed();
+ }
+ void set_callback_if_needed() {
+ }
+ } param_name = ( !(g_log_filter->is_enabled()) ) ? (void*)0 : g_l .base()-> read_msg().gather().out() << "this is so cool " << i++;
+#endif
+
L_ << "this is so cool " << i++;
- L_ << "this is so cool again " << i++;
+ // L_ << "this is so cool again " << i++;
// Step 9 : Enjoy!
}
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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -44,8 +44,8 @@
const char * m_msg;
no_gather() : m_msg(0) {}
const char * msg() const { return m_msg; }
- void out(const char* msg) { m_msg = msg; }
- void out(const std::string& msg) { m_msg = msg.c_str(); }
+ void *out(const char* msg) { m_msg = msg; return this; }
+ void *out(const std::string& msg) { m_msg = msg.c_str(); return this; }
};
// Step 1 : Specify your logging class(es)
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-04 06:35:26 EST (Fri, 04 Jan 2008)
@@ -38,8 +38,9 @@
// Step 1: Optimize : use a cache string, to make formatting the message faster
BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
-//BOOST_LOG_GATHER_CLASS( use_ostringstream< tss_ostringstream<> > )
+BOOST_LOG_GATHER_CLASS( use_ostringstream< tss_ostringstream<> > )
+#if 0
namespace boost { namespace logging { namespace gather {
template<> struct find<override> {
template<class msg_type> struct from_msg_type {
@@ -47,7 +48,7 @@
};
};
}}}
-
+#endif
#include <boost/logging/format.hpp>
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