Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2007-11-30 07:26:14


Author: jtorjo
Date: 2007-11-30 07:26:14 EST (Fri, 30 Nov 2007)
New Revision: 41491
URL: http://svn.boost.org/trac/boost/changeset/41491

Log:
[logging]
v0.12.6, 30 nov 2007
- created lock_resource_finder namespace - with existing resource lockers
Added:
   sandbox/logging/boost/logging/detail/ts/resource_finder.hpp (contents, props changed)
Text files modified:
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 3 +
   sandbox/logging/boost/logging/detail/scenario.hpp | 48 ++++++---------------------------------
   sandbox/logging/boost/logging/detail/ts/ts_resource.hpp | 2 +
   sandbox/logging/boost/logging/format/formatter/named_spacer.hpp | 21 +++++++++++++++++
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 6 ++++
   5 files changed, 38 insertions(+), 42 deletions(-)

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-30 07:26:14 EST (Fri, 30 Nov 2007)
@@ -1,7 +1,8 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.12.5, 30 nov 2007
+@section changelog_cur_ver Current Version: v0.12.6, 30 nov 2007
+- created lock_resource_finder namespace - with existing resource lockers
 - added boost::logging::spacer
 - removed copyright from examples (scenarios) - so that they're easier to read in the documentation
 - added scoped logs

Modified: sandbox/logging/boost/logging/detail/scenario.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/scenario.hpp (original)
+++ sandbox/logging/boost/logging/detail/scenario.hpp 2007-11-30 07:26:14 EST (Fri, 30 Nov 2007)
@@ -334,55 +334,35 @@
         
         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;
- };
- };
+ template<int secs> struct lock_resource : ::boost::logging::lock_resource_finder::tss_with_cache<secs> {};
 
             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::lock_resource_finder::single_thread lock_resource;
 
             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::lock_resource_finder::tss_once_init<> lock_resource;
 
             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::lock_resource_finder::ts<> lock_resource;
 
             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::lock_resource_finder::single_thread lock_resource;
 
             typedef ::boost::logging::logger_format_write< default_, default_, threading_type, gather, lock_resource> type;
         };
@@ -506,28 +486,16 @@
 
         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::lock_resource_finder::single_thread lock_resource;
             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::lock_resource_finder::tss_with_cache<> lock_resource;
 
             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::lock_resource_finder::ts<> lock_resource;
 
             typedef ::boost::logging::logger_format_write< default_, default_, th::ts_write, default_, lock_resource > type ;
         };

Added: sandbox/logging/boost/logging/detail/ts/resource_finder.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/ts/resource_finder.hpp 2007-11-30 07:26:14 EST (Fri, 30 Nov 2007)
@@ -0,0 +1,62 @@
+// resource_finder.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_resource_finder_HPP_DEFINED
+#define JT28092007_resource_finder_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#ifndef JT28092007_ts_resource_HPP_DEFINED
+#error never include directly, this is included by default
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+namespace boost { namespace logging { namespace lock_resource_finder {
+ template<class mutex = boost::logging::threading::mutex> struct ts {
+ template<class lock_type> struct finder {
+ typedef typename boost::logging::locker::ts_resource<lock_type, mutex > type;
+ };
+ };
+
+ struct single_thread {
+ template<class lock_type> struct finder {
+ typedef typename boost::logging::locker::ts_resource_single_thread<lock_type> type;
+ };
+ };
+
+#if !defined( BOOST_LOG_NO_TSS)
+ template<int refresh_secs = 5, class mutex = boost::logging::threading::mutex > struct tss_with_cache {
+ template<class lock_type> struct finder {
+ typedef typename locker::tss_resource_with_cache<lock_type, refresh_secs, mutex > type;
+ };
+ };
+
+ template<class mutex = boost::logging::threading::mutex> struct tss_once_init {
+ template<class lock_type> struct finder {
+ typedef typename boost::logging::locker::tss_resource_once_init <lock_type, mutex> type;
+ };
+ };
+
+#endif
+
+
+}}}
+
+#endif
+

Modified: sandbox/logging/boost/logging/detail/ts/ts_resource.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/ts/ts_resource.hpp (original)
+++ sandbox/logging/boost/logging/detail/ts/ts_resource.hpp 2007-11-30 07:26:14 EST (Fri, 30 Nov 2007)
@@ -300,5 +300,7 @@
 
 }}}
 
+#include <boost/logging/detail/ts/resource_finder.hpp>
+
 #endif
 

Modified: sandbox/logging/boost/logging/format/formatter/named_spacer.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/formatter/named_spacer.hpp (original)
+++ sandbox/logging/boost/logging/format/formatter/named_spacer.hpp 2007-11-30 07:26:14 EST (Fri, 30 Nov 2007)
@@ -25,9 +25,30 @@
 
 namespace boost { namespace logging { namespace formatter {
 
+namespace detail {
+ template<class convert, class lock_resource, class format_base> struct named_spacer_context {
+ typedef use_default<lock_resource, boost::logging::
+
+ typedef typename lock_resource::template finder<write_info>::type data;
+
+ };
+}
     // when adding generic ones, make sure I keep the same convert (append or prepend)
+ // named_spacer<> - you specify the convert !!!
+ // if adding a generic formatter and convert is diff than ours, compile error!
     // also, allow adding more in one step : .add(..).add(..)....
 
+template<class lock_resource = default_, class convert = do_convert_format::prepend, class format_base = base<> >
+ struct named_spacer_t : is_generic, non_const_context< detail::named_spacer_context<convert,lock_resource,format_base> > {
+ // have array or so?
+
+ // allow to change the format string
+ // unknown % - ignore, treat as string
+ // % - escape char
+ // %% = %
+
+};
+
 
 
 }}}

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-30 07:26:14 EST (Fri, 30 Nov 2007)
@@ -434,7 +434,7 @@
>
                         </File>
                         <File
- RelativePath="..\..\..\..\..\boost\logging\scenario.hpp"
+ RelativePath="..\..\..\..\..\boost\logging\detail\scenario.hpp"
>
                         </File>
                         <File
@@ -453,6 +453,10 @@
                                 Name="ts"
>
                                 <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\ts\resource_finder.hpp"
+ >
+ </File>
+ <File
                                         RelativePath="..\..\..\..\..\boost\logging\detail\ts\ts.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