Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2007-11-13 04:05:01


Author: jtorjo
Date: 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
New Revision: 41055
URL: http://svn.boost.org/trac/boost/changeset/41055

Log:
[logging]
v0.11.9, 12 nov 2007
- applied small patch from Jens Seidel - many thanks!
- moved a few files into detail/ directory - to avoid confusion as to what header should be included when
Added:
   sandbox/logging/boost/logging/detail/error.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/filter.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/level.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/macros.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/scenario.hpp (contents, props changed)
Removed:
   sandbox/logging/boost/logging/error.hpp
   sandbox/logging/boost/logging/filter.hpp
   sandbox/logging/boost/logging/level.hpp
   sandbox/logging/boost/logging/macros.hpp
   sandbox/logging/boost/logging/scenario.hpp
Text files modified:
   sandbox/logging/boost/logging/detail/format_write_detail.hpp | 2 +-
   sandbox/logging/boost/logging/detail/fwd.hpp | 2 +-
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 4 +++-
   sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp | 1 +
   sandbox/logging/boost/logging/detail/use_format_write.hpp | 2 +-
   sandbox/logging/boost/logging/format/formatter/tags.hpp | 1 +
   sandbox/logging/boost/logging/format_fwd.hpp | 6 +++---
   sandbox/logging/boost/logging/logging.hpp | 6 +++---
   sandbox/logging/boost/logging/tags.hpp | 6 +++---
   sandbox/logging/lib/logging/internal/gcc/main.cpp | 2 --
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 4 ++++
   11 files changed, 21 insertions(+), 15 deletions(-)

Added: sandbox/logging/boost/logging/detail/error.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/error.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -0,0 +1,31 @@
+// error.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_error_HPP_DEFINED
+#define JT28092007_error_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+namespace boost { namespace logging {
+
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/detail/filter.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/filter.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -0,0 +1,218 @@
+// filter.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_filter_HPP_DEFINED
+#define JT28092007_filter_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <boost/logging/detail/forward_constructor.hpp>
+#include <boost/logging/detail/tss/tss.hpp>
+
+namespace boost {
+
+/**
+ @brief Root namespace. All the logging lib is contained in this namespace, or sub-namespaces of this one.
+*/
+namespace logging {
+
+
+/**
+ @brief Contains filter implementations. A filter tells the logger if it's enabled or not.
+
+
+ The %filter namespace contains a few implementations of %filter classes.
+
+ @c Filter is just a concept. You decide what a @c filter is.
+
+ The minimalistic filter knows only if <i>it's enabled</i>
+
+ Filter interface:
+ @code
+ struct some_filter class {
+ // is filter enabled
+ bool is_enabled() ;
+
+ // ... whatever else you might want
+ };
+ @endcode
+
+ In your logger, you can use any filter class that's already here, or implement your own. Implementing a filter is usually as easy as it gets:
+
+ @code
+ struct filter_no_ts {
+ filter_no_ts() : m_enabled(true) {}
+
+ bool is_enabled() const { return m_enabled; }
+ void set_enabled(bool enabled) { m_enabled = enabled; }
+ private:
+ bool m_enabled;
+ };
+ @endcode
+
+ The filters defined by the library are:
+ - filter::no_ts
+ - filter::ts
+ - filter::use_tss_with_cache
+ - filter::always_enabled
+ - filter::always_disabled
+ - filter::debug_enabled
+ - filter::release_enabled
+ - filter_level (when you use levels)
+
+*/
+namespace filter {
+
+
+/**
+ Manages is_enabled/set_enabled in a non-thread-safe way (usually, this is the default filter - unless you override it).
+
+ If you change set_enabled() while program is running, it can take a bit to propagate
+ between threads. Most of the time, this should be acceptable.
+*/
+struct no_ts {
+ no_ts() : m_enabled(true) {}
+ bool is_enabled() const { return m_enabled; }
+ void set_enabled(bool enabled) { m_enabled = enabled; }
+private:
+ bool m_enabled;
+};
+
+
+/**
+ Filter that is always enabled
+*/
+struct always_enabled {
+ static bool is_enabled() { return true; }
+};
+
+
+/**
+ Filter that is always disabled
+*/
+struct always_disabled {
+ static bool is_enabled() { return false; }
+};
+
+
+/**
+ Filter that is enabled in debug mode
+*/
+struct debug_enabled {
+#ifndef NDEBUG
+ static bool is_enabled() { return true; }
+#else
+ static bool is_enabled() { return false; }
+#endif
+};
+
+
+/**
+ Filter that is enabled in release mode
+*/
+struct release_enabled {
+#ifdef NDEBUG
+ static bool is_enabled() { return true; }
+#else
+ static bool is_enabled() { return false; }
+#endif
+};
+
+
+/**
+ Thread-safe filter. Manages is_enabled/set_enabled in a thread-safe way.
+ However, it manages it rather ineffiently - always locking before asking.
+*/
+struct ts {
+ ts() : m_enabled(true) {}
+ bool is_enabled() const {
+ threading::scoped_lock lk(m_cs);
+ return m_enabled;
+ }
+ void set_enabled(bool enabled) {
+ threading::scoped_lock lk(m_cs);
+ m_enabled = enabled;
+ }
+private:
+ bool m_enabled;
+ mutable threading::mutex m_cs;
+};
+
+
+
+
+#ifndef BOOST_LOG_NO_TSS
+
+/**
+ Uses TSS (Thread Specific Storage) to find out if a filter is enabled or not. It caches the current "is_enabled" on each thread.
+ Then, at a given period, it retrieves the real "is_enabled".
+
+ @remarks
+
+ Another implementation can be done, which could be faster - where you retrieve the "is_enabled" each X calls on a given thread
+ (like, every 20 calls on a given thread)
+*/
+template<int default_cache_secs = 5> struct use_tss_with_cache {
+ typedef locker::tss_resource_with_cache<bool,default_cache_secs> data;
+
+ use_tss_with_cache(int cache_secs = default_cache_secs) : m_enabled(true, cache_secs) {}
+ bool is_enabled() const {
+ typename data::read enabled(m_enabled);
+ return enabled.use();
+ }
+ void set_enabled(bool enabled) {
+ typename data::write cur(m_enabled);
+ cur.use() = enabled;
+ }
+private:
+ data m_enabled;
+};
+
+
+struct use_tss_once_init {
+ typedef locker::tss_resource_once_init<bool> data;
+
+ use_tss_once_init() : m_enabled(true) {}
+ bool is_enabled() const {
+ data::read enabled(m_enabled);
+ return enabled.use();
+ }
+ void set_enabled(bool enabled) {
+ data::write cur(m_enabled);
+ cur.use() = enabled;
+ }
+private:
+ data m_enabled;
+};
+
+
+#endif // #ifndef BOOST_LOG_NO_TSS
+
+
+} // namespace filter
+
+
+
+
+
+}}
+
+
+#endif
+

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 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -14,7 +14,7 @@
 // See http://www.torjo.com/log2/ for more details
 
 #ifndef JT28092007_format_HPP_DEFINED
-#error do not include directly include logging/format.hpp or logging/writer/format_write.hpp instead
+#error do not include directly include boost/logging/format.hpp or boost/logging/writer/format_write.hpp instead
 #endif
 
 // this is fixed!

Modified: sandbox/logging/boost/logging/detail/fwd.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/fwd.hpp (original)
+++ sandbox/logging/boost/logging/detail/fwd.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <boost/logging/detail/log_keeper.hpp>
-#include <boost/logging/macros.hpp>
+#include <boost/logging/detail/macros.hpp>
 
 #include <boost/logging/detail/ts/ts.hpp>
 #include <boost/logging/detail/ts/ts_resource.hpp>

Added: sandbox/logging/boost/logging/detail/level.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/level.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -0,0 +1,216 @@
+// level.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_level_HPP_DEFINED
+#define JT28092007_level_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <boost/logging/detail/tss/tss.hpp>
+
+namespace boost { namespace logging {
+
+/**
+ @brief Handling levels - classes that can hold and/or deal with levels - filters and level holders
+
+ By default we have these levels:
+
+ - debug (smallest level),
+ - info,
+ - warning ,
+ - error ,
+ - fatal (highest level)
+
+ Depending on which level is enabled for your application, some messages will reach the log: those
+ messages having at least that level. For instance, if info level is enabled, all
+ logged messages will reach the log.
+ If warning level is enabled, all messages are logged, but the warnings.
+ If debug level is enabled, messages that have levels debug, error, fatal will be logged.
+
+ @sa filter_level
+*/
+namespace level {
+ /** the higher the level , the more critical the error */
+ typedef unsigned int type;
+
+ enum {
+ disable_all = (type)-1,
+ enable_all = 0,
+ debug = 1000,
+ info = 2000,
+ warning = 3000,
+ error = 4000,
+ fatal = 5000
+ };
+
+ /**
+ @brief Filter - holds the level, in a non-thread-safe way.
+
+ Holds the level, and tells you if a specific level is enabled.
+ It does this in a non-thread-safe way.
+
+ If you change set_enabled() while program is running, it can take a bit to propagate
+ between threads. Most of the time, this should be acceptable.
+ */
+ struct holder_no_ts {
+ holder_no_ts(type default_level = enable_all) : m_level(default_level) {}
+ bool is_enabled(type level) const { return level >= m_level; }
+ void set_enabled(type level) {
+ m_level = level;
+ }
+ private:
+ type m_level;
+ };
+
+
+ /**
+ @brief Filter - holds the level, in a thread-safe way.
+
+ Holds the level, and tells you if a specific level is enabled.
+ It does this in a thread-safe way.
+
+ However, it manages it rather ineffiently - always locking before asking.
+ */
+ struct holder_ts {
+ typedef boost::logging::threading::scoped_lock scoped_lock;
+ typedef boost::logging::threading::mutex mutex;
+
+ holder_ts(type default_level = enable_all) : m_level(default_level) {}
+ bool is_enabled(type level) const {
+ scoped_lock lk(m_cs);
+ return level >= m_level;
+ }
+ void set_enabled(type level) {
+ scoped_lock lk(m_cs);
+ m_level = level;
+ }
+ private:
+ type m_level;
+ mutable mutex m_cs;
+ };
+
+ /**
+ @brief Filter - holds the level - and tells you at compile time if a filter is enabled or not.
+
+ Fix (compile time) holder
+ */
+ template<int fix_level = debug> struct holder_compile_time {
+ static bool is_enabled(type level) {
+ return fix_level >= level;
+ }
+ };
+
+
+
+
+#ifndef BOOST_LOG_NO_TSS
+
+ /**
+ @brief Filter - holds the level, in a thread-safe way, using TLS.
+
+ Uses TLS (Thread Local Storage) to find out if a level is enabled or not. It caches the current "is_enabled" on each thread.
+ Then, at a given period, it retrieves the real "level".
+ */
+ template<int default_cache_secs = 5> struct holder_tss_with_cache {
+ typedef locker::tss_resource_with_cache<type, default_cache_secs> data;
+
+ holder_tss_with_cache(int cache_secs = default_cache_secs, type default_level = enable_all) : m_level(default_level, cache_secs) {}
+ bool is_enabled(type test_level) const {
+ typename data::read cur_level(m_level);
+ return test_level >= cur_level.use();
+ }
+ void set_enabled(type level) {
+ typename data::write cur_level(m_level);
+ cur_level.use() = level;
+ }
+ private:
+ data m_level;
+ };
+
+ struct holder_tss_once_init {
+ typedef locker::tss_resource_once_init<type> data;
+
+ holder_tss_once_init(type default_level = enable_all) : m_level(default_level) {}
+ bool is_enabled(type test_level) const {
+ data::read cur_level(m_level);
+ return test_level >= cur_level.use();
+ }
+ void set_enabled(type level) {
+ data::write cur_level(m_level);
+ cur_level.use() = level;
+ }
+ private:
+ data m_level;
+ };
+#endif
+
+
+
+ typedef boost::logging::level_holder_type holder;
+} // namespace level
+
+/**
+ @brief It's a filter that enables holding a level
+
+ Allows managing whether a level is enabled or not (so that a logggers that wants to use levels,
+ can determine if it's enabled or not)
+
+ Example:
+
+@code
+typedef process_msg< gather::ostream_like::return_str<>, write_to_file> processor;
+level::holder_no_ts level_holder;
+
+typedef logger<processor, filter_level<level::holder_no_ts, level::debug> > debug_logger;
+typedef logger<processor, filter_level<level::holder_no_ts, level::error> > error_logger;
+typedef logger<processor, filter_level<level::holder_no_ts, level::info> > info_logger;
+
+debug_logger g_log_dbg( init_both, "dbg.txt", &level_holder );
+error_logger g_log_err( init_both, "err.txt", &level_holder );
+info_logger g_log_app( init_both, "out.txt", &level_holder );
+#define LAPP_ if ( !g_log_app) ; else g_log_app->read_msg().gather().out()
+#define LERR_ if ( !g_log_err) ; else g_log_err->read_msg().gather().out()
+#define LDBG_ if ( !g_log_dbg) ; else g_log_dbg->read_msg().gather().out()
+
+
+// usage
+LAPP_ << "info at : " << idx << " : reading word " << word;
+LDBG_ << "debug at: " << idx << ", reading " << word;
+LERR_ << "error at: " << idx << ", while reading " << word;
+
+@endcode
+
+ @sa level::holder_no_ts, level::holder_ts, level::holder_tss_with_cache
+*/
+template<class holder_type, int level> struct filter_level {
+ filter_level(holder_type * level_holder) : m_level_holder(*level_holder) {}
+ bool is_enabled() const {
+ return m_level_holder.is_enabled(level);
+ }
+private:
+ holder_type & m_level_holder;
+};
+
+}}
+
+
+
+
+#endif
+

Added: sandbox/logging/boost/logging/detail/macros.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/macros.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -0,0 +1,235 @@
+// 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
+
+// IMPORTANT : the JT28092007_macros_HPP_DEFINED needs to remain constant - don't change the macro name!
+#ifndef JT28092007_macros_HPP_DEFINED
+#define JT28092007_macros_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#if !defined(BOOST_LOG_TSS_USE_INTERNAL) && !defined(BOOST_LOG_TSS_USE_BOOST) && !defined(BOOST_LOG_TSS_USE_CUSTOM) && !defined(BOOST_LOG_NO_TSS)
+// use has not specified what TSS strategy to use
+#define BOOST_LOG_TSS_USE_INTERNAL
+
+#endif
+
+#include <boost/current_function.hpp>
+
+namespace boost { namespace logging {
+
+/**
+ @page macros Macros - how, what for?
+
+ The need for macros - creating the object before main.
+
+ When dealing with logs, you will most likely want to use macros: simply to write less.
+ To be efficient, you usually want to write to a log only if it's enabled.
+
+ Either you always write: <tt> if ( g_log) g_log .... </tt>, or, you create macros:
+
+ @code
+ #define L_ if ( g_log) g_log ....
+ @endcode
+
+ FIXME to be continued :) explain about the fact that you can create your own macros, depending on what *you* want
+
+ Explain why the if ; else strategy: so that if withing if (x) LOG_ ... ; else blabla - still ok
+ #define L_ if ( g_single_log) ; else g_single_log->read_msg().gather().msg()
+
+ don't want compile fast? then log.h will look easier; but - are you sure you don't want to turn compile fast off?
+
+ @section macros_gathering
+
+ FIXME
+
+ Macros
+ - BOOST_LOG_COMPILE_FAST_ON
+ - BOOST_LOG_COMPILE_FAST_OFF
+ - BOOST_LOG_COMPILE_FAST
+
+BOOST_LOG_TSS_USE_INTERNAL
+BOOST_LOG_TSS_USE_BOOST
+BOOST_LOG_TSS_USE_CUSTOM
+BOOST_LOG_NO_TSS
+
+*/
+
+#ifdef BOOST_LOG_COMPILE_FAST_ON
+#define BOOST_LOG_COMPILE_FAST
+#elif defined(BOOST_LOG_COMPILE_FAST_OFF)
+#undef BOOST_LOG_COMPILE_FAST
+#else
+// by default, turned on
+#define BOOST_LOG_COMPILE_FAST
+#endif
+
+
+
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Defining filter Macros
+
+#ifdef BOOST_LOG_COMPILE_FAST
+// ****** Fast compile ******
+
+#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::implement_default_logger< gather_msg, write_msg* > p( &(name ## _boost_log_impl_().writer()) ); \
+ 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()) ); \
+ 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;
+
+
+
+#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;
+
+
+#endif
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 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;
+
+
+
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// 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
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Format and Destination Macros
+
+/** @section BOOST_LOG_FORMAT_MSG BOOST_LOG_FORMAT_MSG
+
+@note
+ When using BOOST_LOG_FORMAT_MSG or BOOST_LOG_DESTINATION_MSG, you must not be within any namespace scope.
+
+ This is because when using this macro, as @c msg_class, you can specify any of your class, or
+ something residing in @c boost::logging namespace.
+*/
+#define BOOST_LOG_FORMAT_MSG(msg_class) \
+ namespace boost { namespace logging { namespace formatter { \
+ template<> struct msg_type<override> { typedef msg_class & type; typedef msg_class raw_type; }; \
+ }}}
+
+/**
+
+@note
+ When using BOOST_LOG_FORMAT_MSG or BOOST_LOG_DESTINATION_MSG, you must not be within any namespace scope.
+
+ This is because when using this macro, as @c msg_class, you can specify any of your class, or
+ something residing in @c boost::logging namespace.
+*/
+#define BOOST_LOG_DESTINATION_MSG(msg_class) \
+ namespace boost { namespace logging { namespace destination { \
+ template<> struct msg_type<override> { typedef const msg_class & type; typedef msg_class raw_type; }; \
+ }}}
+
+
+
+
+
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Tags
+
+#define BOOST_LOG_STRINGIZE2(x) #x
+#define BOOST_LOG_STRINGIZE(x) BOOST_LOG_STRINGIZE2(x)
+#define BOOST_LOG_FILE_AND_LINE __FILE__ ":" BOOST_LOG_STRINGIZE(__LINE__) " "
+
+
+#define BOOST_LOG_TAG(tag_type) ::boost::logging::tag:: tag_type
+
+#define BOOST_LOG_TAG_LEVEL(lvl) BOOST_LOG_TAG(level)(::boost::logging::level ::lvl )
+
+#define BOOST_LOG_TAG_FILELINE BOOST_LOG_TAG(file_line) (BOOST_LOG_FILE_AND_LINE)
+
+#define BOOST_LOG_TAG_FUNCTION BOOST_LOG_TAG(function) (BOOST_CURRENT_FUNCTION)
+
+
+}}
+
+#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 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -1,7 +1,9 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.11.8, 12 nov 2007
+@section changelog_cur_ver Current Version: v0.11.9, 12 nov 2007
+- applied small patch from Jens Seidel - many thanks!
+- moved a few files into detail/ directory - to avoid confusion as to what header should be included when
 - fixed bug when including only macros.hpp file - many thanks Jens Seidel!
 - added Boost.Logging Requirements page
 - added tags - and documented them

Added: sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -0,0 +1,37 @@
+namespace boost { namespace logging {
+
+/**
+@page headers_to_include Headers to #include
+
+- when using Formatters and Destinations
+
+@code
+// when declaring logs
+#include <boost/logging/format_fwd.hpp>
+
+// when defining logs and you don't use thread-safety
+#include <boost/logging/format.hpp>
+
+// when defining logs and you use thread-safety
+#include <boost/logging/format_ts.hpp>
+@endcode
+
+
+- when using tags
+
+@code
+#include <boost/logging/tags.hpp>
+@endcode
+
+
+- when using Logging, without Formatters/Destinations
+
+@code
+#include <boost/logging/logging.hpp>
+@endcode
+
+
+
+*/
+
+}}

Modified: sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -21,6 +21,7 @@
         - @ref scenario_multiple_files_log_cpp
         - @ref scenario_multiple_files_main
 
+- @ref headers_to_include "Headers to #include"
 - @ref scenario::usage "Choose the best filter/logger class, based on your application's needs"
 - @ref tag "Using tags"
 

Added: sandbox/logging/boost/logging/detail/scenario.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/scenario.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -0,0 +1,551 @@
+// scenario.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_format_fwd_HPP_DEFINED
+#error Please include boost/logging/format_fwd.hpp instead
+#endif
+
+#ifndef JT28092007_scenario_HPP_DEFINED
+#define JT28092007_scenario_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+namespace boost { namespace logging {
+/** @page your_scenario_examples Examples of customizing your scenario
+
+Example 1:
+- Use a filter that uses per-thread caching with resync once at 10 secs,
+- The filter uses levels
+- Use a logger that will favor speed
+
+@code
+using namespace boost::logging::scenario::usage;
+typedef use< filter_::change::often<10>, filter_::level::use_levels, default_, logger_::favor::speed> finder;
+
+BOOST_DECLARE_LOG_FILTER(g_log_filter, finder::filter);
+BOOST_DECLARE_LOG(g_l, finder::logger)
+...
+@endcode
+
+
+Example 2:
+- Use a filter that is initialized only once, when multiple threads are running
+- The filter does not use levels
+- Use a logger that is initialized only once, when only one thread is running
+
+@code
+using namespace boost::logging::scenario::usage;
+typedef use< filter_::change::set_once_when_multiple_threads, filter_::level::no_levels, logger_::change::set_once_when_one_thread> finder;
+
+BOOST_DECLARE_LOG_FILTER(g_log_filter, finder::filter);
+BOOST_DECLARE_LOG(g_l, finder::logger)
+...
+@endcode
+
+To see scenario::usage used in code:
+- @ref common_your_scenario "Click to see description of the example"
+- @ref common_your_scenario_code "Click to see the code"
+*/
+
+namespace filter {
+ template<int> struct use_tss_with_cache ;
+ struct no_ts ;
+ struct ts ;
+ struct use_tss_once_init ;
+}
+
+namespace level {
+ template<int> struct holder_tss_with_cache ;
+ struct holder_tss_once_init ;
+ struct holder_ts;
+ struct holder_no_ts ;
+}
+namespace writer {
+ namespace threading {
+ struct no_ts ;
+ struct ts_write ;
+ struct on_dedicated_thread ;
+ }
+}
+
+/**
+@brief Use this when you have a specific scenario, and want the best logger/filter classes that fit that scenario. Check out scenario::usage and scenario::ts.
+
+For example, if you want to specify a %scenario based on usage:
+
+@copydoc your_scenario_examples
+
+*/
+namespace scenario {
+
+/**
+@brief If you want the library to choose the best logger/filter classes based on how your application will %use the loggers and filters, %use this namespace.
+
+First, don't forget to
+
+@code
+using namespace boost::logging::scenario::usage;
+@endcode
+
+Then, you can specify the logger and filter, in a very easy manner
+
+@copydoc your_scenario_examples
+
+*/
+namespace usage {
+
+ /** @brief Filter usage settings : filter_::change and filter_::level
+ */
+ namespace filter_ {
+ /** @brief When does the filter change? */
+ namespace change {
+ /** @brief Optimize for %often %change. Does per-thread caching. At a given period, it re-synchronizes.
+
+ This is the default, for a multi-threaded application.
+
+ @param cache_period_secs At what period should we re-syncronize
+ */
+ template<int cache_period_secs = 5> struct often {};
+
+ /** @brief Set only once, when there's only one thread running - thus, you don't need to worry about thread-syncronizing */
+ struct set_once_when_one_thread {};
+
+ /** @brief Set only once, when there could be multiple thread running.
+
+ We automatically implement a strategy to check if the filter/logger has been initialized, and when it's done, we cache
+ the result on every thread */
+ struct set_once_when_multiple_threads {};
+
+ /** @brief This is always accurate. However, it's the slowest too.
+
+ In case of multiple threads, it always locks the logger/filter before accessing it.
+
+ Not recommended, you should usually go with another strategy (often, set_once_when_one_thread or set_once_when_multiple_threads)
+ */
+ struct always_accurate {};
+
+ /** @brief Single threading. It doesn't matter when/how %often the filter/logger changes.
+
+ This is the default, for a single-threaded application.
+ */
+ struct single_thread {};
+
+#ifdef BOOST_HAS_THREADS
+ typedef often<> default_;
+#else
+ typedef single_thread default_;
+#endif
+ }
+
+ /** @brief What's our "level" policy? */
+ namespace level {
+ /** @brief not using levels (default) */
+ struct no_levels {};
+ /** @brief using levels */
+ struct use_levels {};
+
+ typedef no_levels default_;
+ }
+ }
+
+ /** @brief Logger %usage settings : logger_::change and logger_::favor
+ */
+ namespace logger_ {
+ /** @brief When does the logger change, that is, how often do you manipulate it?
+
+ Note that using the log does not mean changing it.
+ Manipulation means invoking non-const functions on the logger, like
+ adding/removing formatters/destinations for instance.
+ */
+ namespace change {
+ /** @brief Optimize for often change. Does per-thread caching. At a given period, it re-synchronizes. This is the default, for multi-threaded applications.
+
+ @param cache_period_secs At what period should we re-syncronize
+ */
+ template<int cache_period_secs = 5> struct often {};
+
+ /** @brief Set only once, when there's only one thread running - thus, you don't need to worry about thread-syncronizing */
+ struct set_once_when_one_thread {};
+
+ /** @brief Set only once, when there could be multiple thread running.
+
+ We automatically implement a strategy to check if the filter/logger has been initialized, and when it's done, we cache
+ the result on every thread */
+ struct set_once_when_multiple_threads {};
+
+ /** @brief This is always accurate. However, it's the slowest too.
+
+ In case of multiple threads, it always locks the logger/filter before accessing it.
+
+ Not recommended, you should usually go with another strategy (often, set_once_when_one_thread or set_once_when_multiple_threads)
+ */
+ struct always_accurate {};
+
+ /** @brief Single threading. It doesn't matter when/how often the filter/logger changes. This is the default, for single-threaded applications.
+ */
+ struct single_thread {};
+
+#ifdef BOOST_HAS_THREADS
+ typedef often<> default_;
+#else
+ typedef single_thread default_;
+#endif
+ }
+
+ /** @brief When logging, what should we %favor? */
+ namespace favor {
+ /** @brief This will favor speed (logging will happen on a dedicated thread). The only problem you could have is if the application crashes.
+
+ In this case, on Windows, the rest of the application will continue, and any non-flushed log message will be flushed.
+
+ On POSIX, this may not be the case.
+ */
+ struct speed {};
+
+ /** @brief All messages will be logged. This is the default for multi-threaded application
+ */
+ struct correctness {};
+
+ /** @brief Single threading. It doesn't matter when/how often the filter/logger changes. This is the default, for single-threaded applications.
+ */
+ struct single_thread {};
+
+#ifdef BOOST_HAS_THREADS
+ typedef correctness default_;
+#else
+ typedef single_thread default_;
+#endif
+ }
+
+ /** @brief How do you gather the message? */
+ namespace gather {
+ /** @brief Using the cool operator<< (default) */
+ struct ostream_like {};
+
+ /** @brief If you want to use your custom class, specify it here */
+ template<class gather_type> struct custom {};
+
+ typedef ostream_like default_;
+ }
+ }
+
+
+
+ namespace detail_find_filter {
+ namespace level = ::boost::logging::scenario::usage::filter_::level;
+ namespace change = ::boost::logging::scenario::usage::filter_::change;
+
+ //////// use levels
+
+ template<class change_> struct find_filter_use_levels {};
+
+ template<int period_secs> struct find_filter_use_levels< change::often<period_secs> > {
+ typedef ::boost::logging::level::holder_tss_with_cache<period_secs> type;
+ };
+
+ template<> struct find_filter_use_levels< change::set_once_when_one_thread > {
+ typedef ::boost::logging::level::holder_no_ts type;
+ };
+
+ template<> struct find_filter_use_levels< change::set_once_when_multiple_threads > {
+ typedef ::boost::logging::level::holder_tss_once_init type;
+ };
+
+ template<> struct find_filter_use_levels< change::always_accurate > {
+ typedef ::boost::logging::level::holder_ts type;
+ };
+
+ template<> struct find_filter_use_levels< change::single_thread > {
+ typedef ::boost::logging::level::holder_no_ts type;
+ };
+
+
+
+ //////// no levels
+
+ template<class change_> struct find_filter_no_levels {};
+
+ template<int period_secs> struct find_filter_no_levels< change::often<period_secs> > {
+ typedef ::boost::logging::filter::use_tss_with_cache<period_secs> type;
+ };
+
+ template<> struct find_filter_no_levels< change::set_once_when_one_thread > {
+ typedef ::boost::logging::filter::no_ts type;
+ };
+
+ template<> struct find_filter_no_levels< change::set_once_when_multiple_threads > {
+ typedef ::boost::logging::filter::use_tss_once_init type;
+ };
+
+ template<> struct find_filter_no_levels< change::always_accurate > {
+ typedef ::boost::logging::filter::ts type;
+ };
+
+ template<> struct find_filter_no_levels< change::single_thread > {
+ typedef ::boost::logging::filter::no_ts type;
+ };
+
+
+
+ template<class change_, class level_> struct find_filter {
+ // no levels
+ typedef typename find_filter_no_levels<change_>::type type;
+ };
+
+ template<class change_> struct find_filter<change_, level::use_levels> {
+ typedef typename find_filter_use_levels<change_>::type type;
+ };
+
+ }
+
+
+ namespace detail_find_logger {
+ namespace favor = ::boost::logging::scenario::usage::logger_::favor;
+ namespace change = ::boost::logging::scenario::usage::logger_::change;
+ namespace th = ::boost::logging::writer::threading;
+ namespace gather_usage = ::boost::logging::scenario::usage::logger_::gather;
+
+ template<class favor_> struct find_threading_from_favor {};
+ template<> struct find_threading_from_favor<favor::speed> { typedef th::on_dedicated_thread type; };
+ template<> struct find_threading_from_favor<favor::correctness> { typedef th::ts_write type; };
+ template<> struct find_threading_from_favor<favor::single_thread> { typedef th::no_ts type; };
+
+ template<class gather_type> struct find_gather {};
+ template<> struct find_gather<gather_usage::ostream_like> { typedef ::boost::logging::default_ type; };
+ template<class custom_gather> struct find_gather<gather_usage::custom<custom_gather> > { typedef custom_gather type; };
+
+ template<class favor_, class change_, class gather> struct find_logger {};
+
+ template<class favor_, int period_secs, class gather> struct find_logger< favor_, change::often<period_secs>, gather > {
+ typedef typename find_threading_from_favor<favor_>::type threading_type;
+ template<int secs> struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename ::boost::logging::locker::tss_resource_with_cache<lock_type, secs, boost::logging::threading::mutex > type;
+ };
+ };
+
+ typedef ::boost::logging::logger_format_write < default_, default_, threading_type, gather, lock_resource<period_secs> > type;
+ };
+
+ template<class favor_, class gather> struct find_logger< favor_, change::set_once_when_one_thread, gather > {
+ typedef typename find_threading_from_favor<favor_>::type threading_type;
+ struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename locker::ts_resource_single_thread<lock_type> type;
+ };
+ };
+
+ typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
+ };
+
+ template<class favor_, class gather> struct find_logger< favor_, change::set_once_when_multiple_threads, gather > {
+ typedef typename find_threading_from_favor<favor_>::type threading_type;
+ struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename locker::tss_resource_once_init<lock_type, boost::logging::threading::mutex > type;
+ };
+ };
+
+ typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
+ };
+
+ template<class favor_, class gather> struct find_logger< favor_, change::always_accurate, gather > {
+ typedef typename find_threading_from_favor<favor_>::type threading_type;
+ struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename locker::ts_resource<lock_type, boost::logging::threading::mutex > type;
+ };
+ };
+
+ typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
+ };
+
+ template<class favor_, class gather> struct find_logger< favor_, change::single_thread, gather > {
+ typedef typename find_threading_from_favor<favor_>::type threading_type;
+ struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename locker::ts_resource_single_thread<lock_type> type;
+ };
+ };
+
+ typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
+ };
+ }
+
+ /**
+ @brief Finds a filter class and a logger class that fit your application's needs
+
+ For this to happen, you will first need to specify your needs (the template parameters you'll pass to this class)
+
+ @param filter_change (optional) How does the %filter change? Any of the classes in the filter_::change namespace
+ @param filter_level_ (optional) Does our %filter %use levels? Any of the classes in the filter_::level namespace
+ @param logger_change (optional) How does our %logger change? Any of the classes in the logger_::change namespace
+ @param logger_favor (optional) What does the %logger favor? Any of the classes in the logger_::favor namespace
+ @param logger_gather (optional) What to %use as gather class. Any of the classes in the logger_::gather namespace
+
+ @copydoc your_scenario_examples
+ */
+ template<
+ class filter_change = default_,
+ class filter_level = default_,
+ class logger_change = default_,
+ class logger_favor = default_,
+ class logger_gather = default_ >
+ struct use {
+
+ private:
+ typedef typename use_default<filter_change, filter_::change::default_ >::type filter_change_type;
+ typedef typename use_default<filter_level, filter_::level::default_ >::type filter_level_type;
+
+ typedef typename use_default<logger_change, logger_::change::default_ >::type logger_change_type;
+ typedef typename use_default<logger_favor, logger_::favor::default_>::type logger_favor_type;
+ typedef typename use_default<logger_gather, logger_::gather::default_>::type gather_usage_type;
+
+ typedef typename detail_find_logger::find_gather<gather_usage_type> ::type gather_type;
+
+ public:
+ typedef typename detail_find_filter::find_filter<filter_change_type, filter_level_type>::type filter;
+ typedef typename detail_find_logger::find_logger< logger_favor_type, logger_change_type, gather_type>::type logger;
+
+ };
+}
+
+/**
+@brief Find out the right logger/filter, based on thread-safety of logger(s)/filter(s)
+
+First, don't forget to
+
+@code
+using namespace boost::logging::scenario::ts;
+@endcode
+
+Then, you can specify the logger and filter, in a very easy manner
+
+Example:
+- Use a filter that uses TSS (Thread Specific Storage)
+- The filter uses levels
+- Use a logger that uses TSS
+
+@code
+using namespace boost::logging::scenario::ts;
+typedef use< filter_::use_tss, level_::use_levels, logger_::use_tss> finder;
+
+BOOST_DECLARE_LOG_FILTER(g_log_filter, finder::filter);
+BOOST_DECLARE_LOG(g_l, finder::logger)
+...
+@endcode
+
+
+To see how you can specify the logger/filter based on how you will %use them, see usage namespace.
+*/
+namespace ts {
+ /** @brief filter uses levels? */
+ struct level_ {
+ /** @brief type of %filter levels %usage */
+ enum type {
+ /** @brief %use levels */
+ use_levels,
+ /** @brief don't %use levels */
+ no_levels
+ };
+ };
+
+ /** @brief filter thread-safety */
+ struct filter_ {
+ /** @brief type of filter thread-safety */
+ enum type {
+ /** @brief not thread-safe */
+ none,
+ /** @brief %use TSS (thread-specific storage) */
+ use_tss,
+ /** @brief thread-safe (but slow) */
+ ts
+ };
+ };
+
+ /** logger thread-safety */
+ struct logger_ {
+ /** @brief type of logger thread-safety */
+ enum type {
+ /** @brief not thread-safe */
+ none,
+ /** @brief %use TSS (thread-specific storage) */
+ use_tss,
+ /** @brief thread-safe (but slow) */
+ ts
+ };
+ };
+
+ namespace detail {
+ namespace th = ::boost::logging::writer::threading;
+
+ template<filter_::type,level_::type> struct find_filter {};
+ template<> struct find_filter<filter_::none, level_::no_levels > { typedef ::boost::logging::filter::no_ts type; };
+ template<> struct find_filter<filter_::use_tss, level_::no_levels> { typedef ::boost::logging::filter::use_tss_with_cache<5> type; };
+ template<> struct find_filter<filter_::ts, level_::no_levels> { typedef ::boost::logging::filter::ts type; };
+
+ template<> struct find_filter<filter_::none, level_::use_levels > { typedef ::boost::logging::level::holder_no_ts type; };
+ template<> struct find_filter<filter_::use_tss, level_::use_levels > { typedef ::boost::logging::level::holder_tss_with_cache<5> type; };
+ template<> struct find_filter<filter_::ts, level_::use_levels > { typedef ::boost::logging::level::holder_ts type; };
+
+ template<logger_::type> struct find_logger {};
+ template<> struct find_logger<logger_::none> {
+ struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename locker::ts_resource_single_thread<lock_type> type;
+ };
+ };
+ typedef ::boost::logging::logger_format_write< default_, default_, th::no_ts, default_, lock_resource > type ;
+ };
+ template<> struct find_logger<logger_::use_tss> {
+ struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename ::boost::logging::locker::tss_resource_with_cache<lock_type, 5, boost::logging::threading::mutex > type;
+ };
+ };
+
+ typedef ::boost::logging::logger_format_write< default_, default_, th::ts_write, default_, lock_resource > type ;
+ };
+ template<> struct find_logger<logger_::ts> {
+ struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename locker::ts_resource<lock_type, boost::logging::threading::mutex > type;
+ };
+ };
+
+ typedef ::boost::logging::logger_format_write< default_, default_, th::ts_write, default_, lock_resource > type ;
+ };
+ }
+
+ /** @brief Find the right logger and filter, based on thread-safety: filter_::type, level_::type and logger_::type
+
+ @copydoc ts
+ */
+ template<filter_::type filter_type, level_::type level_type, logger_::type logger_type> struct use {
+ typedef typename detail::find_filter<filter_type,level_type>::type filter;
+ typedef typename detail::find_logger<logger_type>::type logger;
+ };
+}
+
+}
+
+}}
+
+#endif
+

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 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -14,7 +14,7 @@
 // See http://www.torjo.com/log2/ for more details
 
 #ifndef JT28092007_format_write_detail_HPP_DEFINED
-#error do not include this directly. Include logging/format.hpp instead
+#error do not include this directly. Include boost/logging/format.hpp instead
 #endif
 
 #ifndef JT28092007_use_format_write_HPP_DEFINED

Deleted: sandbox/logging/boost/logging/error.hpp
==============================================================================
--- sandbox/logging/boost/logging/error.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
+++ (empty file)
@@ -1,31 +0,0 @@
-// error.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_error_HPP_DEFINED
-#define JT28092007_error_HPP_DEFINED
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include <boost/logging/detail/fwd.hpp>
-
-namespace boost { namespace logging {
-
-}}
-
-#endif
-

Deleted: sandbox/logging/boost/logging/filter.hpp
==============================================================================
--- sandbox/logging/boost/logging/filter.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
+++ (empty file)
@@ -1,218 +0,0 @@
-// filter.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_filter_HPP_DEFINED
-#define JT28092007_filter_HPP_DEFINED
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include <boost/logging/detail/fwd.hpp>
-#include <boost/logging/detail/forward_constructor.hpp>
-#include <boost/logging/detail/tss/tss.hpp>
-
-namespace boost {
-
-/**
- @brief Root namespace. All the logging lib is contained in this namespace, or sub-namespaces of this one.
-*/
-namespace logging {
-
-
-/**
- @brief Contains filter implementations. A filter tells the logger if it's enabled or not.
-
-
- The %filter namespace contains a few implementations of %filter classes.
-
- @c Filter is just a concept. You decide what a @c filter is.
-
- The minimalistic filter knows only if <i>it's enabled</i>
-
- Filter interface:
- @code
- struct some_filter class {
- // is filter enabled
- bool is_enabled() ;
-
- // ... whatever else you might want
- };
- @endcode
-
- In your logger, you can use any filter class that's already here, or implement your own. Implementing a filter is usually as easy as it gets:
-
- @code
- struct filter_no_ts {
- filter_no_ts() : m_enabled(true) {}
-
- bool is_enabled() const { return m_enabled; }
- void set_enabled(bool enabled) { m_enabled = enabled; }
- private:
- bool m_enabled;
- };
- @endcode
-
- The filters defined by the library are:
- - filter::no_ts
- - filter::ts
- - filter::use_tss_with_cache
- - filter::always_enabled
- - filter::always_disabled
- - filter::debug_enabled
- - filter::release_enabled
- - filter_level (when you use levels)
-
-*/
-namespace filter {
-
-
-/**
- Manages is_enabled/set_enabled in a non-thread-safe way (usually, this is the default filter - unless you override it).
-
- If you change set_enabled() while program is running, it can take a bit to propagate
- between threads. Most of the time, this should be acceptable.
-*/
-struct no_ts {
- no_ts() : m_enabled(true) {}
- bool is_enabled() const { return m_enabled; }
- void set_enabled(bool enabled) { m_enabled = enabled; }
-private:
- bool m_enabled;
-};
-
-
-/**
- Filter that is always enabled
-*/
-struct always_enabled {
- static bool is_enabled() { return true; }
-};
-
-
-/**
- Filter that is always disabled
-*/
-struct always_disabled {
- static bool is_enabled() { return false; }
-};
-
-
-/**
- Filter that is enabled in debug mode
-*/
-struct debug_enabled {
-#ifndef NDEBUG
- static bool is_enabled() { return true; }
-#else
- static bool is_enabled() { return false; }
-#endif
-};
-
-
-/**
- Filter that is enabled in release mode
-*/
-struct release_enabled {
-#ifdef NDEBUG
- static bool is_enabled() { return true; }
-#else
- static bool is_enabled() { return false; }
-#endif
-};
-
-
-/**
- Thread-safe filter. Manages is_enabled/set_enabled in a thread-safe way.
- However, it manages it rather ineffiently - always locking before asking.
-*/
-struct ts {
- ts() : m_enabled(true) {}
- bool is_enabled() const {
- threading::scoped_lock lk(m_cs);
- return m_enabled;
- }
- void set_enabled(bool enabled) {
- threading::scoped_lock lk(m_cs);
- m_enabled = enabled;
- }
-private:
- bool m_enabled;
- mutable threading::mutex m_cs;
-};
-
-
-
-
-#ifndef BOOST_LOG_NO_TSS
-
-/**
- Uses TSS (Thread Specific Storage) to find out if a filter is enabled or not. It caches the current "is_enabled" on each thread.
- Then, at a given period, it retrieves the real "is_enabled".
-
- @remarks
-
- Another implementation can be done, which could be faster - where you retrieve the "is_enabled" each X calls on a given thread
- (like, every 20 calls on a given thread)
-*/
-template<int default_cache_secs = 5> struct use_tss_with_cache {
- typedef locker::tss_resource_with_cache<bool,default_cache_secs> data;
-
- use_tss_with_cache(int cache_secs = default_cache_secs) : m_enabled(true, cache_secs) {}
- bool is_enabled() const {
- typename data::read enabled(m_enabled);
- return enabled.use();
- }
- void set_enabled(bool enabled) {
- typename data::write cur(m_enabled);
- cur.use() = enabled;
- }
-private:
- data m_enabled;
-};
-
-
-struct use_tss_once_init {
- typedef locker::tss_resource_once_init<bool> data;
-
- use_tss_once_init() : m_enabled(true) {}
- bool is_enabled() const {
- data::read enabled(m_enabled);
- return enabled.use();
- }
- void set_enabled(bool enabled) {
- data::write cur(m_enabled);
- cur.use() = enabled;
- }
-private:
- data m_enabled;
-};
-
-
-#endif // #ifndef BOOST_LOG_NO_TSS
-
-
-} // namespace filter
-
-
-
-
-
-}}
-
-
-#endif
-

Modified: sandbox/logging/boost/logging/format/formatter/tags.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/formatter/tags.hpp (original)
+++ sandbox/logging/boost/logging/format/formatter/tags.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -26,6 +26,7 @@
 #include <boost/logging/detail/manipulator.hpp>
 #include <boost/logging/format/formatter/time.hpp>
 #include <sstream>
+#include <boost/logging/format_fwd.hpp> // dump_level
 
 namespace boost { namespace logging { namespace formatter {
 

Modified: sandbox/logging/boost/logging/format_fwd.hpp
==============================================================================
--- sandbox/logging/boost/logging/format_fwd.hpp (original)
+++ sandbox/logging/boost/logging/format_fwd.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -14,7 +14,7 @@
 // See http://www.torjo.com/log2/ for more details
 
 
-
+// this needs to be fixed!
 #ifndef JT28092007_format_fwd_HPP_DEFINED
 #define JT28092007_format_fwd_HPP_DEFINED
 
@@ -110,7 +110,7 @@
 };
 
 /**
- Specifies the class that will dump the levels . Used by formatter::tag::level class.
+ Specifies the class that will dump the levels. Used by formatter::tag::level class.
 */
 template<class T = override> struct dump_level {
     typedef dump_default_levels type;
@@ -120,7 +120,7 @@
 }}
 
 
-#include <boost/logging/scenario.hpp>
+#include <boost/logging/detail/scenario.hpp>
 
 #endif
 

Deleted: sandbox/logging/boost/logging/level.hpp
==============================================================================
--- sandbox/logging/boost/logging/level.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
+++ (empty file)
@@ -1,216 +0,0 @@
-// level.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_level_HPP_DEFINED
-#define JT28092007_level_HPP_DEFINED
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include <boost/logging/detail/fwd.hpp>
-#include <boost/logging/detail/tss/tss.hpp>
-
-namespace boost { namespace logging {
-
-/**
- @brief Handling levels - classes that can hold and/or deal with levels - filters and level holders
-
- By default we have these levels:
-
- - debug (smallest level),
- - info,
- - warning ,
- - error ,
- - fatal (highest level)
-
- Depending on which level is enabled for your application, some messages will reach the log: those
- messages having at least that level. For instance, if info level is enabled, all
- logged messages will reach the log.
- If warning level is enabled, all messages are logged, but the warnings.
- If debug level is enabled, messages that have levels debug, error, fatal will be logged.
-
- @sa filter_level
-*/
-namespace level {
- /** the higher the level , the more critical the error */
- typedef unsigned int type;
-
- enum {
- disable_all = (type)-1,
- enable_all = 0,
- debug = 1000,
- info = 2000,
- warning = 3000,
- error = 4000,
- fatal = 5000
- };
-
- /**
- @brief Filter - holds the level, in a non-thread-safe way.
-
- Holds the level, and tells you if a specific level is enabled.
- It does this in a non-thread-safe way.
-
- If you change set_enabled() while program is running, it can take a bit to propagate
- between threads. Most of the time, this should be acceptable.
- */
- struct holder_no_ts {
- holder_no_ts(type default_level = enable_all) : m_level(default_level) {}
- bool is_enabled(type level) const { return level >= m_level; }
- void set_enabled(type level) {
- m_level = level;
- }
- private:
- type m_level;
- };
-
-
- /**
- @brief Filter - holds the level, in a thread-safe way.
-
- Holds the level, and tells you if a specific level is enabled.
- It does this in a thread-safe way.
-
- However, it manages it rather ineffiently - always locking before asking.
- */
- struct holder_ts {
- typedef boost::logging::threading::scoped_lock scoped_lock;
- typedef boost::logging::threading::mutex mutex;
-
- holder_ts(type default_level = enable_all) : m_level(default_level) {}
- bool is_enabled(type level) const {
- scoped_lock lk(m_cs);
- return level >= m_level;
- }
- void set_enabled(type level) {
- scoped_lock lk(m_cs);
- m_level = level;
- }
- private:
- type m_level;
- mutable mutex m_cs;
- };
-
- /**
- @brief Filter - holds the level - and tells you at compile time if a filter is enabled or not.
-
- Fix (compile time) holder
- */
- template<int fix_level = debug> struct holder_compile_time {
- static bool is_enabled(type level) {
- return fix_level >= level;
- }
- };
-
-
-
-
-#ifndef BOOST_LOG_NO_TSS
-
- /**
- @brief Filter - holds the level, in a thread-safe way, using TLS.
-
- Uses TLS (Thread Local Storage) to find out if a level is enabled or not. It caches the current "is_enabled" on each thread.
- Then, at a given period, it retrieves the real "level".
- */
- template<int default_cache_secs = 5> struct holder_tss_with_cache {
- typedef locker::tss_resource_with_cache<type, default_cache_secs> data;
-
- holder_tss_with_cache(int cache_secs = default_cache_secs, type default_level = enable_all) : m_level(default_level, cache_secs) {}
- bool is_enabled(type test_level) const {
- typename data::read cur_level(m_level);
- return test_level >= cur_level.use();
- }
- void set_enabled(type level) {
- typename data::write cur_level(m_level);
- cur_level.use() = level;
- }
- private:
- data m_level;
- };
-
- struct holder_tss_once_init {
- typedef locker::tss_resource_once_init<type> data;
-
- holder_tss_once_init(type default_level = enable_all) : m_level(default_level) {}
- bool is_enabled(type test_level) const {
- data::read cur_level(m_level);
- return test_level >= cur_level.use();
- }
- void set_enabled(type level) {
- data::write cur_level(m_level);
- cur_level.use() = level;
- }
- private:
- data m_level;
- };
-#endif
-
-
-
- typedef boost::logging::level_holder_type holder;
-} // namespace level
-
-/**
- @brief It's a filter that enables holding a level
-
- Allows managing whether a level is enabled or not (so that a logggers that wants to use levels,
- can determine if it's enabled or not)
-
- Example:
-
-_at_code
-typedef process_msg< gather::ostream_like::return_str<>, write_to_file> processor;
-level::holder_no_ts level_holder;
-
-typedef logger<processor, filter_level<level::holder_no_ts, level::debug> > debug_logger;
-typedef logger<processor, filter_level<level::holder_no_ts, level::error> > error_logger;
-typedef logger<processor, filter_level<level::holder_no_ts, level::info> > info_logger;
-
-debug_logger g_log_dbg( init_both, "dbg.txt", &level_holder );
-error_logger g_log_err( init_both, "err.txt", &level_holder );
-info_logger g_log_app( init_both, "out.txt", &level_holder );
-#define LAPP_ if ( !g_log_app) ; else g_log_app->read_msg().gather().out()
-#define LERR_ if ( !g_log_err) ; else g_log_err->read_msg().gather().out()
-#define LDBG_ if ( !g_log_dbg) ; else g_log_dbg->read_msg().gather().out()
-
-
-// usage
-LAPP_ << "info at : " << idx << " : reading word " << word;
-LDBG_ << "debug at: " << idx << ", reading " << word;
-LERR_ << "error at: " << idx << ", while reading " << word;
-
-_at_endcode
-
- @sa level::holder_no_ts, level::holder_ts, level::holder_tss_with_cache
-*/
-template<class holder_type, int level> struct filter_level {
- filter_level(holder_type * level_holder) : m_level_holder(*level_holder) {}
- bool is_enabled() const {
- return m_level_holder.is_enabled(level);
- }
-private:
- holder_type & m_level_holder;
-};
-
-}}
-
-
-
-
-#endif
-

Modified: sandbox/logging/boost/logging/logging.hpp
==============================================================================
--- sandbox/logging/boost/logging/logging.hpp (original)
+++ sandbox/logging/boost/logging/logging.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -22,11 +22,11 @@
 #endif
 
 #include <boost/logging/detail/fwd.hpp>
-#include <boost/logging/filter.hpp>
+#include <boost/logging/detail/filter.hpp>
 #include <boost/logging/detail/logger.hpp>
-#include <boost/logging/macros.hpp>
+#include <boost/logging/detail/macros.hpp>
 #include <boost/logging/detail/tss/tss.hpp>
-#include <boost/logging/level.hpp>
+#include <boost/logging/detail/level.hpp>
 
 // just in case we might think of using formatters
 #include <boost/logging/detail/format_msg_type.hpp>

Deleted: sandbox/logging/boost/logging/macros.hpp
==============================================================================
--- sandbox/logging/boost/logging/macros.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
+++ (empty file)
@@ -1,235 +0,0 @@
-// 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
-
-// IMPORTANT : the JT28092007_macros_HPP_DEFINED needs to remain constant - don't change the macro name!
-#ifndef JT28092007_macros_HPP_DEFINED
-#define JT28092007_macros_HPP_DEFINED
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#if !defined(BOOST_LOG_TSS_USE_INTERNAL) && !defined(BOOST_LOG_TSS_USE_BOOST) && !defined(BOOST_LOG_TSS_USE_CUSTOM) && !defined(BOOST_LOG_NO_TSS)
-// use has not specified what TSS strategy to use
-#define BOOST_LOG_TSS_USE_INTERNAL
-
-#endif
-
-#include <boost/current_function.hpp>
-
-namespace boost { namespace logging {
-
-/**
- @page macros Macros - how, what for?
-
- The need for macros - creating the object before main.
-
- When dealing with logs, you will most likely want to use macros: simply to write less.
- To be efficient, you usually want to write to a log only if it's enabled.
-
- Either you always write: <tt> if ( g_log) g_log .... </tt>, or, you create macros:
-
- @code
- #define L_ if ( g_log) g_log ....
- @endcode
-
- FIXME to be continued :) explain about the fact that you can create your own macros, depending on what *you* want
-
- Explain why the if ; else strategy: so that if withing if (x) LOG_ ... ; else blabla - still ok
- #define L_ if ( g_single_log) ; else g_single_log->read_msg().gather().msg()
-
- don't want compile fast? then log.h will look easier; but - are you sure you don't want to turn compile fast off?
-
- @section macros_gathering
-
- FIXME
-
- Macros
- - BOOST_LOG_COMPILE_FAST_ON
- - BOOST_LOG_COMPILE_FAST_OFF
- - BOOST_LOG_COMPILE_FAST
-
-BOOST_LOG_TSS_USE_INTERNAL
-BOOST_LOG_TSS_USE_BOOST
-BOOST_LOG_TSS_USE_CUSTOM
-BOOST_LOG_NO_TSS
-
-*/
-
-#ifdef BOOST_LOG_COMPILE_FAST_ON
-#define BOOST_LOG_COMPILE_FAST
-#elif defined(BOOST_LOG_COMPILE_FAST_OFF)
-#undef BOOST_LOG_COMPILE_FAST
-#else
-// by default, turned on
-#define BOOST_LOG_COMPILE_FAST
-#endif
-
-
-
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Defining filter Macros
-
-#ifdef BOOST_LOG_COMPILE_FAST
-// ****** Fast compile ******
-
-#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::implement_default_logger< gather_msg, write_msg* > p( &(name ## _boost_log_impl_().writer()) ); \
- 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()) ); \
- 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;
-
-
-
-#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;
-
-
-#endif
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// 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;
-
-
-
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// 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
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Format and Destination Macros
-
-/** @section BOOST_LOG_FORMAT_MSG BOOST_LOG_FORMAT_MSG
-
-_at_note
- When using BOOST_LOG_FORMAT_MSG or BOOST_LOG_DESTINATION_MSG, you must not be within any namespace scope.
-
- This is because when using this macro, as @c msg_class, you can specify any of your class, or
- something residing in @c boost::logging namespace.
-*/
-#define BOOST_LOG_FORMAT_MSG(msg_class) \
- namespace boost { namespace logging { namespace formatter { \
- template<> struct msg_type<override> { typedef msg_class & type; typedef msg_class raw_type; }; \
- }}}
-
-/**
-
-_at_note
- When using BOOST_LOG_FORMAT_MSG or BOOST_LOG_DESTINATION_MSG, you must not be within any namespace scope.
-
- This is because when using this macro, as @c msg_class, you can specify any of your class, or
- something residing in @c boost::logging namespace.
-*/
-#define BOOST_LOG_DESTINATION_MSG(msg_class) \
- namespace boost { namespace logging { namespace destination { \
- template<> struct msg_type<override> { typedef const msg_class & type; typedef msg_class raw_type; }; \
- }}}
-
-
-
-
-
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Tags
-
-#define BOOST_LOG_STRINGIZE2(x) #x
-#define BOOST_LOG_STRINGIZE(x) BOOST_LOG_STRINGIZE2(x)
-#define BOOST_LOG_FILE_AND_LINE __FILE__ ":" BOOST_LOG_STRINGIZE(__LINE__) " "
-
-
-#define BOOST_LOG_TAG(tag_type) ::boost::logging::tag:: tag_type
-
-#define BOOST_LOG_TAG_LEVEL(lvl) BOOST_LOG_TAG(level)(::boost::logging::level ::lvl )
-
-#define BOOST_LOG_TAG_FILELINE BOOST_LOG_TAG(file_line) (BOOST_LOG_FILE_AND_LINE)
-
-#define BOOST_LOG_TAG_FUNCTION BOOST_LOG_TAG(function) (BOOST_CURRENT_FUNCTION)
-
-
-}}
-
-#endif
-

Deleted: sandbox/logging/boost/logging/scenario.hpp
==============================================================================
--- sandbox/logging/boost/logging/scenario.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
+++ (empty file)
@@ -1,548 +0,0 @@
-// scenario.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_scenario_HPP_DEFINED
-#define JT28092007_scenario_HPP_DEFINED
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include <boost/logging/detail/fwd.hpp>
-
-namespace boost { namespace logging {
-/** @page your_scenario_examples Examples of customizing your scenario
-
-Example 1:
-- Use a filter that uses per-thread caching with resync once at 10 secs,
-- The filter uses levels
-- Use a logger that will favor speed
-
-_at_code
-using namespace boost::logging::scenario::usage;
-typedef use< filter_::change::often<10>, filter_::level::use_levels, default_, logger_::favor::speed> finder;
-
-BOOST_DECLARE_LOG_FILTER(g_log_filter, finder::filter);
-BOOST_DECLARE_LOG(g_l, finder::logger)
-...
-_at_endcode
-
-
-Example 2:
-- Use a filter that is initialized only once, when multiple threads are running
-- The filter does not use levels
-- Use a logger that is initialized only once, when only one thread is running
-
-_at_code
-using namespace boost::logging::scenario::usage;
-typedef use< filter_::change::set_once_when_multiple_threads, filter_::level::no_levels, logger_::change::set_once_when_one_thread> finder;
-
-BOOST_DECLARE_LOG_FILTER(g_log_filter, finder::filter);
-BOOST_DECLARE_LOG(g_l, finder::logger)
-...
-_at_endcode
-
-To see scenario::usage used in code:
-- @ref common_your_scenario "Click to see description of the example"
-- @ref common_your_scenario_code "Click to see the code"
-*/
-
-namespace filter {
- template<int> struct use_tss_with_cache ;
- struct no_ts ;
- struct ts ;
- struct use_tss_once_init ;
-}
-
-namespace level {
- template<int> struct holder_tss_with_cache ;
- struct holder_tss_once_init ;
- struct holder_ts;
- struct holder_no_ts ;
-}
-namespace writer {
- namespace threading {
- struct no_ts ;
- struct ts_write ;
- struct on_dedicated_thread ;
- }
-}
-
-/**
-_at_brief Use this when you have a specific scenario, and want the best logger/filter classes that fit that scenario. Check out scenario::usage and scenario::ts.
-
-For example, if you want to specify a %scenario based on usage:
-
-_at_copydoc your_scenario_examples
-
-*/
-namespace scenario {
-
-/**
-_at_brief If you want the library to choose the best logger/filter classes based on how your application will %use the loggers and filters, %use this namespace.
-
-First, don't forget to
-
-_at_code
-using namespace boost::logging::scenario::usage;
-_at_endcode
-
-Then, you can specify the logger and filter, in a very easy manner
-
-_at_copydoc your_scenario_examples
-
-*/
-namespace usage {
-
- /** @brief Filter usage settings : filter_::change and filter_::level
- */
- namespace filter_ {
- /** @brief When does the filter change? */
- namespace change {
- /** @brief Optimize for %often %change. Does per-thread caching. At a given period, it re-synchronizes.
-
- This is the default, for a multi-threaded application.
-
- @param cache_period_secs At what period should we re-syncronize
- */
- template<int cache_period_secs = 5> struct often {};
-
- /** @brief Set only once, when there's only one thread running - thus, you don't need to worry about thread-syncronizing */
- struct set_once_when_one_thread {};
-
- /** @brief Set only once, when there could be multiple thread running.
-
- We automatically implement a strategy to check if the filter/logger has been initialized, and when it's done, we cache
- the result on every thread */
- struct set_once_when_multiple_threads {};
-
- /** @brief This is always accurate. However, it's the slowest too.
-
- In case of multiple threads, it always locks the logger/filter before accessing it.
-
- Not recommended, you should usually go with another strategy (often, set_once_when_one_thread or set_once_when_multiple_threads)
- */
- struct always_accurate {};
-
- /** @brief Single threading. It doesn't matter when/how %often the filter/logger changes.
-
- This is the default, for a single-threaded application.
- */
- struct single_thread {};
-
-#ifdef BOOST_HAS_THREADS
- typedef often<> default_;
-#else
- typedef single_thread default_;
-#endif
- }
-
- /** @brief What's our "level" policy? */
- namespace level {
- /** @brief not using levels (default) */
- struct no_levels {};
- /** @brief using levels */
- struct use_levels {};
-
- typedef no_levels default_;
- }
- }
-
- /** @brief Logger %usage settings : logger_::change and logger_::favor
- */
- namespace logger_ {
- /** @brief When does the logger change, that is, how often do you manipulate it?
-
- Note that using the log does not mean changing it.
- Manipulation means invoking non-const functions on the logger, like
- adding/removing formatters/destinations for instance.
- */
- namespace change {
- /** @brief Optimize for often change. Does per-thread caching. At a given period, it re-synchronizes. This is the default, for multi-threaded applications.
-
- @param cache_period_secs At what period should we re-syncronize
- */
- template<int cache_period_secs = 5> struct often {};
-
- /** @brief Set only once, when there's only one thread running - thus, you don't need to worry about thread-syncronizing */
- struct set_once_when_one_thread {};
-
- /** @brief Set only once, when there could be multiple thread running.
-
- We automatically implement a strategy to check if the filter/logger has been initialized, and when it's done, we cache
- the result on every thread */
- struct set_once_when_multiple_threads {};
-
- /** @brief This is always accurate. However, it's the slowest too.
-
- In case of multiple threads, it always locks the logger/filter before accessing it.
-
- Not recommended, you should usually go with another strategy (often, set_once_when_one_thread or set_once_when_multiple_threads)
- */
- struct always_accurate {};
-
- /** @brief Single threading. It doesn't matter when/how often the filter/logger changes. This is the default, for single-threaded applications.
- */
- struct single_thread {};
-
-#ifdef BOOST_HAS_THREADS
- typedef often<> default_;
-#else
- typedef single_thread default_;
-#endif
- }
-
- /** @brief When logging, what should we %favor? */
- namespace favor {
- /** @brief This will favor speed (logging will happen on a dedicated thread). The only problem you could have is if the application crashes.
-
- In this case, on Windows, the rest of the application will continue, and any non-flushed log message will be flushed.
-
- On POSIX, this may not be the case.
- */
- struct speed {};
-
- /** @brief All messages will be logged. This is the default for multi-threaded application
- */
- struct correctness {};
-
- /** @brief Single threading. It doesn't matter when/how often the filter/logger changes. This is the default, for single-threaded applications.
- */
- struct single_thread {};
-
-#ifdef BOOST_HAS_THREADS
- typedef correctness default_;
-#else
- typedef single_thread default_;
-#endif
- }
-
- /** @brief How do you gather the message? */
- namespace gather {
- /** @brief Using the cool operator<< (default) */
- struct ostream_like {};
-
- /** @brief If you want to use your custom class, specify it here */
- template<class gather_type> struct custom {};
-
- typedef ostream_like default_;
- }
- }
-
-
-
- namespace detail_find_filter {
- namespace level = ::boost::logging::scenario::usage::filter_::level;
- namespace change = ::boost::logging::scenario::usage::filter_::change;
-
- //////// use levels
-
- template<class change_> struct find_filter_use_levels {};
-
- template<int period_secs> struct find_filter_use_levels< change::often<period_secs> > {
- typedef ::boost::logging::level::holder_tss_with_cache<period_secs> type;
- };
-
- template<> struct find_filter_use_levels< change::set_once_when_one_thread > {
- typedef ::boost::logging::level::holder_no_ts type;
- };
-
- template<> struct find_filter_use_levels< change::set_once_when_multiple_threads > {
- typedef ::boost::logging::level::holder_tss_once_init type;
- };
-
- template<> struct find_filter_use_levels< change::always_accurate > {
- typedef ::boost::logging::level::holder_ts type;
- };
-
- template<> struct find_filter_use_levels< change::single_thread > {
- typedef ::boost::logging::level::holder_no_ts type;
- };
-
-
-
- //////// no levels
-
- template<class change_> struct find_filter_no_levels {};
-
- template<int period_secs> struct find_filter_no_levels< change::often<period_secs> > {
- typedef ::boost::logging::filter::use_tss_with_cache<period_secs> type;
- };
-
- template<> struct find_filter_no_levels< change::set_once_when_one_thread > {
- typedef ::boost::logging::filter::no_ts type;
- };
-
- template<> struct find_filter_no_levels< change::set_once_when_multiple_threads > {
- typedef ::boost::logging::filter::use_tss_once_init type;
- };
-
- template<> struct find_filter_no_levels< change::always_accurate > {
- typedef ::boost::logging::filter::ts type;
- };
-
- template<> struct find_filter_no_levels< change::single_thread > {
- typedef ::boost::logging::filter::no_ts type;
- };
-
-
-
- template<class change_, class level_> struct find_filter {
- // no levels
- typedef typename find_filter_no_levels<change_>::type type;
- };
-
- template<class change_> struct find_filter<change_, level::use_levels> {
- typedef typename find_filter_use_levels<change_>::type type;
- };
-
- }
-
-
- namespace detail_find_logger {
- namespace favor = ::boost::logging::scenario::usage::logger_::favor;
- namespace change = ::boost::logging::scenario::usage::logger_::change;
- namespace th = ::boost::logging::writer::threading;
- namespace gather_usage = ::boost::logging::scenario::usage::logger_::gather;
-
- template<class favor_> struct find_threading_from_favor {};
- template<> struct find_threading_from_favor<favor::speed> { typedef th::on_dedicated_thread type; };
- template<> struct find_threading_from_favor<favor::correctness> { typedef th::ts_write type; };
- template<> struct find_threading_from_favor<favor::single_thread> { typedef th::no_ts type; };
-
- template<class gather_type> struct find_gather {};
- template<> struct find_gather<gather_usage::ostream_like> { typedef ::boost::logging::default_ type; };
- template<class custom_gather> struct find_gather<gather_usage::custom<custom_gather> > { typedef custom_gather type; };
-
- template<class favor_, class change_, class gather> struct find_logger {};
-
- template<class favor_, int period_secs, class gather> struct find_logger< favor_, change::often<period_secs>, gather > {
- typedef typename find_threading_from_favor<favor_>::type threading_type;
- template<int secs> struct lock_resource {
- template<class lock_type> struct finder {
- typedef typename ::boost::logging::locker::tss_resource_with_cache<lock_type, secs, boost::logging::threading::mutex > type;
- };
- };
-
- typedef ::boost::logging::logger_format_write < default_, default_, threading_type, gather, lock_resource<period_secs> > type;
- };
-
- template<class favor_, class gather> struct find_logger< favor_, change::set_once_when_one_thread, gather > {
- typedef typename find_threading_from_favor<favor_>::type threading_type;
- struct lock_resource {
- template<class lock_type> struct finder {
- typedef typename locker::ts_resource_single_thread<lock_type> type;
- };
- };
-
- typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
- };
-
- template<class favor_, class gather> struct find_logger< favor_, change::set_once_when_multiple_threads, gather > {
- typedef typename find_threading_from_favor<favor_>::type threading_type;
- struct lock_resource {
- template<class lock_type> struct finder {
- typedef typename locker::tss_resource_once_init<lock_type, boost::logging::threading::mutex > type;
- };
- };
-
- typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
- };
-
- template<class favor_, class gather> struct find_logger< favor_, change::always_accurate, gather > {
- typedef typename find_threading_from_favor<favor_>::type threading_type;
- struct lock_resource {
- template<class lock_type> struct finder {
- typedef typename locker::ts_resource<lock_type, boost::logging::threading::mutex > type;
- };
- };
-
- typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
- };
-
- template<class favor_, class gather> struct find_logger< favor_, change::single_thread, gather > {
- typedef typename find_threading_from_favor<favor_>::type threading_type;
- struct lock_resource {
- template<class lock_type> struct finder {
- typedef typename locker::ts_resource_single_thread<lock_type> type;
- };
- };
-
- typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
- };
- }
-
- /**
- @brief Finds a filter class and a logger class that fit your application's needs
-
- For this to happen, you will first need to specify your needs (the template parameters you'll pass to this class)
-
- @param filter_change (optional) How does the %filter change? Any of the classes in the filter_::change namespace
- @param filter_level_ (optional) Does our %filter %use levels? Any of the classes in the filter_::level namespace
- @param logger_change (optional) How does our %logger change? Any of the classes in the logger_::change namespace
- @param logger_favor (optional) What does the %logger favor? Any of the classes in the logger_::favor namespace
- @param logger_gather (optional) What to %use as gather class. Any of the classes in the logger_::gather namespace
-
- @copydoc your_scenario_examples
- */
- template<
- class filter_change = default_,
- class filter_level = default_,
- class logger_change = default_,
- class logger_favor = default_,
- class logger_gather = default_ >
- struct use {
-
- private:
- typedef typename use_default<filter_change, filter_::change::default_ >::type filter_change_type;
- typedef typename use_default<filter_level, filter_::level::default_ >::type filter_level_type;
-
- typedef typename use_default<logger_change, logger_::change::default_ >::type logger_change_type;
- typedef typename use_default<logger_favor, logger_::favor::default_>::type logger_favor_type;
- typedef typename use_default<logger_gather, logger_::gather::default_>::type gather_usage_type;
-
- typedef typename detail_find_logger::find_gather<gather_usage_type> ::type gather_type;
-
- public:
- typedef typename detail_find_filter::find_filter<filter_change_type, filter_level_type>::type filter;
- typedef typename detail_find_logger::find_logger< logger_favor_type, logger_change_type, gather_type>::type logger;
-
- };
-}
-
-/**
-_at_brief Find out the right logger/filter, based on thread-safety of logger(s)/filter(s)
-
-First, don't forget to
-
-_at_code
-using namespace boost::logging::scenario::ts;
-_at_endcode
-
-Then, you can specify the logger and filter, in a very easy manner
-
-Example:
-- Use a filter that uses TSS (Thread Specific Storage)
-- The filter uses levels
-- Use a logger that uses TSS
-
-_at_code
-using namespace boost::logging::scenario::ts;
-typedef use< filter_::use_tss, level_::use_levels, logger_::use_tss> finder;
-
-BOOST_DECLARE_LOG_FILTER(g_log_filter, finder::filter);
-BOOST_DECLARE_LOG(g_l, finder::logger)
-...
-_at_endcode
-
-
-To see how you can specify the logger/filter based on how you will %use them, see usage namespace.
-*/
-namespace ts {
- /** @brief filter uses levels? */
- struct level_ {
- /** @brief type of %filter levels %usage */
- enum type {
- /** @brief %use levels */
- use_levels,
- /** @brief don't %use levels */
- no_levels
- };
- };
-
- /** @brief filter thread-safety */
- struct filter_ {
- /** @brief type of filter thread-safety */
- enum type {
- /** @brief not thread-safe */
- none,
- /** @brief %use TSS (thread-specific storage) */
- use_tss,
- /** @brief thread-safe (but slow) */
- ts
- };
- };
-
- /** logger thread-safety */
- struct logger_ {
- /** @brief type of logger thread-safety */
- enum type {
- /** @brief not thread-safe */
- none,
- /** @brief %use TSS (thread-specific storage) */
- use_tss,
- /** @brief thread-safe (but slow) */
- ts
- };
- };
-
- namespace detail {
- namespace th = ::boost::logging::writer::threading;
-
- template<filter_::type,level_::type> struct find_filter {};
- template<> struct find_filter<filter_::none, level_::no_levels > { typedef ::boost::logging::filter::no_ts type; };
- template<> struct find_filter<filter_::use_tss, level_::no_levels> { typedef ::boost::logging::filter::use_tss_with_cache<5> type; };
- template<> struct find_filter<filter_::ts, level_::no_levels> { typedef ::boost::logging::filter::ts type; };
-
- template<> struct find_filter<filter_::none, level_::use_levels > { typedef ::boost::logging::level::holder_no_ts type; };
- template<> struct find_filter<filter_::use_tss, level_::use_levels > { typedef ::boost::logging::level::holder_tss_with_cache<5> type; };
- template<> struct find_filter<filter_::ts, level_::use_levels > { typedef ::boost::logging::level::holder_ts type; };
-
- template<logger_::type> struct find_logger {};
- template<> struct find_logger<logger_::none> {
- struct lock_resource {
- template<class lock_type> struct finder {
- typedef typename locker::ts_resource_single_thread<lock_type> type;
- };
- };
- typedef ::boost::logging::logger_format_write< default_, default_, th::no_ts, default_, lock_resource > type ;
- };
- template<> struct find_logger<logger_::use_tss> {
- struct lock_resource {
- template<class lock_type> struct finder {
- typedef typename ::boost::logging::locker::tss_resource_with_cache<lock_type, 5, boost::logging::threading::mutex > type;
- };
- };
-
- typedef ::boost::logging::logger_format_write< default_, default_, th::ts_write, default_, lock_resource > type ;
- };
- template<> struct find_logger<logger_::ts> {
- struct lock_resource {
- template<class lock_type> struct finder {
- typedef typename locker::ts_resource<lock_type, boost::logging::threading::mutex > type;
- };
- };
-
- typedef ::boost::logging::logger_format_write< default_, default_, th::ts_write, default_, lock_resource > type ;
- };
- }
-
- /** @brief Find the right logger and filter, based on thread-safety: filter_::type, level_::type and logger_::type
-
- @copydoc ts
- */
- template<filter_::type filter_type, level_::type level_type, logger_::type logger_type> struct use {
- typedef typename detail::find_filter<filter_type,level_type>::type filter;
- typedef typename detail::find_logger<logger_type>::type logger;
- };
-}
-
-}
-
-}}
-
-#endif
-

Modified: sandbox/logging/boost/logging/tags.hpp
==============================================================================
--- sandbox/logging/boost/logging/tags.hpp (original)
+++ sandbox/logging/boost/logging/tags.hpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -242,7 +242,7 @@
 @param param5 (optional) Fifth tag
 @param param6 (optional) Sixth tag
 @param param7 (optional) Seventh tag
-_at_param param8 (optional) Eith tag
+@param param8 (optional) Eigth tag
 @param param9 (optional) Nineth tag
 @param param10 (optional) Tenth tag
 */
@@ -281,11 +281,11 @@
     }
 
     template<class tag_type> const tag_type & get_tag() const {
- return operator const tag_type&();
+ return this->operator const tag_type&();
     }
 
     void set_string(const string_type & str) {
- m_string = str;
+ tag_base_type::m_string = str;
     }
 
 private:

Modified: sandbox/logging/lib/logging/internal/gcc/main.cpp
==============================================================================
--- sandbox/logging/lib/logging/internal/gcc/main.cpp (original)
+++ sandbox/logging/lib/logging/internal/gcc/main.cpp 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -1,5 +1,3 @@
-#include <boost/logging/macros.hpp>
-#include <boost/logging/detail/fwd.hpp>
 
 
 

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 2007-11-13 04:04:58 EST (Tue, 13 Nov 2007)
@@ -858,6 +858,10 @@
>
                         </File>
                         <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\raw_doc\headers_to_include.hpp"
+ >
+ </File>
+ <File
                                 RelativePath="..\..\..\..\..\boost\logging\detail\raw_doc\main.hpp"
>
                         </File>


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