Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2007-12-01 15:28:28


Author: jtorjo
Date: 2007-12-01 15:28:27 EST (Sat, 01 Dec 2007)
New Revision: 41551
URL: http://svn.boost.org/trac/boost/changeset/41551

Log:
v0.12.9, 1 dec 2007
- added high precision timer
Text files modified:
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 5 ++---
   sandbox/logging/boost/logging/detail/time_format_holder.hpp | 11 ++++++-----
   sandbox/logging/boost/logging/format/formatter/high_precision_time.hpp | 6 +++++-
   sandbox/logging/boost/logging/format/formatter/named_spacer.hpp | 16 ++++++++--------
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 2 +-
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp | 15 ++++++++-------
   6 files changed, 30 insertions(+), 25 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-12-01 15:28:27 EST (Sat, 01 Dec 2007)
@@ -1,9 +1,8 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.12.8, 1 dec 2007
-- added high precision timer - does not work correctly yet
-- bug: the named_spacer does not compile in gcc 4.1 - TO FIX
+@section changelog_cur_ver Current Version: v0.12.9, 1 dec 2007
+- added high precision timer
 - removed "#define BOOST_LOG_COMPILE_FAST_OFF" from samples - no needed and could be misleading
 - added boost::logging::formatter::named_spacer
 - created lock_resource_finder namespace - with existing resource lockers

Modified: sandbox/logging/boost/logging/detail/time_format_holder.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/time_format_holder.hpp (original)
+++ sandbox/logging/boost/logging/detail/time_format_holder.hpp 2007-12-01 15:28:27 EST (Sat, 01 Dec 2007)
@@ -36,9 +36,10 @@
     struct index_info {
         typedef hold_string_type::size_type uint;
         
- index_info(uint src_idx, int *format_idx, int size = 2) : src_idx(src_idx), format_idx(format_idx), size(size) {}
+ index_info(uint src_idx, int *format_idx, int advance_size = 2, int size = 2) : src_idx(src_idx), format_idx(format_idx), advance_size(advance_size), size(size) {}
         uint src_idx;
         int * format_idx;
+ int advance_size;
         int size;
 
         static bool by_index(const index_info & first, const index_info & second) {
@@ -92,11 +93,11 @@
         if ( sec_idx != hold_string_type::npos)
             indexes.push_back( index_info(sec_idx, &m_sec) );
         if ( millisec_idx != hold_string_type::npos)
- indexes.push_back( index_info(millisec_idx, &m_millisec, 3) );
+ indexes.push_back( index_info(millisec_idx, &m_millisec, 4, 3) );
         if ( microsec_idx != hold_string_type::npos)
- indexes.push_back( index_info(microsec_idx, &m_microsec, 6) );
+ indexes.push_back( index_info(microsec_idx, &m_microsec, 5, 6) );
         if ( nanosec_idx != hold_string_type::npos)
- indexes.push_back( index_info(nanosec_idx, &m_nanosec, 9) );
+ indexes.push_back( index_info(nanosec_idx, &m_nanosec, 4, 9) );
 
         std::sort( indexes.begin(), indexes.end(), index_info::by_index);
         
@@ -109,7 +110,7 @@
             std::basic_ostringstream<char_type> cur_sprintf_format;
             cur_sprintf_format << BOOST_LOG_STR("%0") << begin->size << BOOST_LOG_STR("d");
             m_format += cur_sprintf_format.str();
- prev_idx = begin->src_idx + begin->size + 1;
+ prev_idx = begin->src_idx + begin->advance_size + 1;
             ++idx;
         }
 

Modified: sandbox/logging/boost/logging/format/formatter/high_precision_time.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/formatter/high_precision_time.hpp (original)
+++ sandbox/logging/boost/logging/format/formatter/high_precision_time.hpp 2007-12-01 15:28:27 EST (Sat, 01 Dec 2007)
@@ -57,7 +57,11 @@
 $nano - nanoseconds (if the high precision clock allows; otherwise, it pads zeros)
 
 
-Example: high_precision_time("$mm:$ss:$micro");
+Example:
+
+@code
+high_precision_time("$mm:$ss:$micro");
+@endcode
 
 @param convert [optional] In case there needs to be a conversion between std::(w)string and the string that holds your logged message. See convert_format.
 For instance, you might use @ref boost::logging::optimize::cache_string_one_str "a cached_string class" (see @ref boost::logging::optimize "optimize namespace").

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-12-01 15:28:27 EST (Sat, 01 Dec 2007)
@@ -32,7 +32,7 @@
 namespace detail {
 
     template<class convert, class lock_resource, class format_base> struct named_spacer_context {
- typedef typename use_default<lock_resource, boost::logging::lock_resource_finder::tss_with_cache<> >::type lock_resource;
+ typedef typename use_default<lock_resource, boost::logging::lock_resource_finder::tss_with_cache<> >::type lock_resource_type;
         typedef typename use_default<format_base, base<> >::type format_base_type;
         typedef typename use_default<convert, boost::logging::formatter::do_convert_format::prepend> ::type convert_type;
         typedef ::boost::logging::array::shared_ptr_holder<format_base_type, boost::logging::threading::no_mutex > array;
@@ -56,7 +56,7 @@
             typedef std::vector<write_step> write_step_array;
             write_step_array write_steps;
         };
- typedef typename lock_resource::template finder<write_info>::type data;
+ typedef typename lock_resource_type::template finder<write_info>::type data;
         data m_data;
 
         template<class formatter> void add(const string_type & name, formatter fmt) {
@@ -68,7 +68,7 @@
 
         void del(const string_type & name) {
             {
- data::write info(m_data);
+ typename data::write info(m_data);
             format_base_type * p = info->name_to_formatter[name];
             info->name_to_formatter.erase(name);
             info->formatters.del(p);
@@ -77,7 +77,7 @@
         }
 
         void format_string(const string_type & str) {
- { data::write info(m_data);
+ { typename data::write info(m_data);
               info->format_string = str;
             }
             compute_write_steps();
@@ -91,7 +91,7 @@
     private:
         template<class msg_type> void write_with_convert(msg_type & msg, ::boost::logging::formatter::do_convert_format::prepend*) const {
             // prepend
- data::read info(m_data);
+ typename data::read info(m_data);
             typedef typename write_info::write_step_array array;
             for ( typename array::const_reverse_iterator b = info->write_steps.rbegin(), e = info->write_steps.rend(); b != e; ++b) {
                 if ( b->fmt)
@@ -101,7 +101,7 @@
         }
         template<class msg_type> void write_with_convert(msg_type & msg, ...) const {
             // append
- data::read info(m_data);
+ typename data::read info(m_data);
             typedef typename write_info::write_step_array array;
             for ( typename array::const_iterator b = info->write_steps.begin(), e = info->write_steps.end(); b != e; ++b) {
                 convert_type::write( b->prefix, msg);
@@ -130,7 +130,7 @@
         void compute_write_steps() {
             typedef typename string_type::size_type size_type;
 
- data::write info(m_data);
+ typename data::write info(m_data);
             info->write_steps.clear();
             string_type remaining = info->format_string;
             size_type start_search_idx = 0;
@@ -170,7 +170,7 @@
     private:
         // non-generic
         template<class formatter> void add_impl(const string_type & name, formatter fmt, const boost::false_type& ) {
- data::write info(m_data);
+ typename data::write info(m_data);
             format_base_type * p = info->formatters.append(fmt);
             info->name_to_formatter[name] = p;
         }

Modified: sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp
==============================================================================
--- sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp (original)
+++ sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp 2007-12-01 15:28:27 EST (Sat, 01 Dec 2007)
@@ -62,7 +62,7 @@
     // Step 7: add formatters and destinations
     // That is, how the message is to be formatted and where should it be written to
 
- g_l->writer().add_formatter( formatter::high_precision_time("$hh:$mm:$ss:$mili ") );
+ g_l->writer().add_formatter( formatter::high_precision_time("$hh:$mm:$ss:$nano ") );
     g_l->writer().add_formatter( formatter::append_newline_if_needed() );
     g_l->writer().add_destination( destination::file("out.txt") );
     g_l->writer().add_destination( destination::cout() );

Modified: sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp 2007-12-01 15:28:27 EST (Sat, 01 Dec 2007)
@@ -16,12 +16,12 @@
 It will look similar to this one:
 
 @code
-21:03.17 [1] this is so cool 1
-21:03.17 [2] first error 2
-21:03.17 [3] hello, world
-21:03.17 [4] second error 3
-21:03.17 [5] good to be back ;) 4
-21:03.17 [6] third error 5
+21:03.17.243 [1] this is so cool 1
+21:03.17.243 [2] first error 2
+21:03.17.243 [3] hello, world
+21:03.17.243 [4] second error 3
+21:03.17.243 [5] good to be back ;) 4
+21:03.17.243 [6] third error 5
 @endcode
 
 */
@@ -30,6 +30,7 @@
 
 #include <boost/logging/format.hpp>
 #include <boost/logging/writer/ts_write.hpp>
+#include <boost/logging/format/formatter/high_precision_time.hpp>
 
 using namespace boost::logging;
 // Step 3 : Specify your logging class(es)
@@ -53,7 +54,7 @@
     // Step 7: add formatters and destinations
     // That is, how the message is to be formatted...
     g_l->writer().add_formatter( formatter::idx(), "[%] " );
- g_l->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
+ g_l->writer().add_formatter( formatter::high_precision_time("$hh:$mm:$ss.$mili ") );
     g_l->writer().add_formatter( formatter::append_newline() );
 
     // ... and where should it be written to


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk