Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2007-11-22 02:35:02


Author: jtorjo
Date: 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
New Revision: 41296
URL: http://svn.boost.org/trac/boost/changeset/41296

Log:
[logging]
updated doc based on feedback from users
Added:
   sandbox/logging/boost/logging/detail/scoped_log.hpp (contents, props changed)
Text files modified:
   sandbox/logging/boost/logging/detail/fwd.hpp | 7 ++++++-
   sandbox/logging/boost/logging/detail/raw_doc/acknowledgments.hpp | 2 ++
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 2 +-
   sandbox/logging/boost/logging/detail/raw_doc/common_usage_steps_fd.hpp | 2 --
   sandbox/logging/boost/logging/detail/raw_doc/defining_your_logger_filter.hpp | 7 +++----
   sandbox/logging/boost/logging/detail/raw_doc/main.hpp | 4 +++-
   sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp | 4 +---
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 4 ++++
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 34 +++++++++++++++++++++-------------
   sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp | 2 +-
   sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp | 2 +-
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp | 8 ++++----
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp | 2 +-
   sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp | 6 +++---
   sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp | 2 +-
   sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp | 2 +-
   sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp | 6 +++---
   17 files changed, 56 insertions(+), 40 deletions(-)

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-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -37,7 +37,12 @@
 // minimize inclusion of STL headers in our headers!!!
 #include <string>
 
-#define BOOST_LOG_STR(x) (const char_type*)ansi_unicode_char_holder ( x, L ## x)
+/* The following BOOST_LOG_STR("this " "and that") still doesn't work.
+#define BOOST_LOG_HOLDER2(x) x, L ## x
+#define BOOST_LOG_HOLDER(x) BOOST_LOG_HOLDER2(x)
+#define BOOST_LOG_STR(x) (const ::boost::logging::char_type*)ansi_unicode_char_holder ( BOOST_LOG_HOLDER(x) )
+*/
+#define BOOST_LOG_STR(x) (const ::boost::logging::char_type*)::boost::logging::ansi_unicode_char_holder ( x, L ## x )
 
 
 /*

Modified: sandbox/logging/boost/logging/detail/raw_doc/acknowledgments.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/acknowledgments.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/acknowledgments.hpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -15,6 +15,8 @@
 - Jens Seidel - for helping me with issues with gcc (different versions), and extra feedback
 - Martin Baeker - for testing my lib, and pointing out problems
 - Thomas Kreisel - for testing my lib in Linux, providing patches, finding possible problems in my lib
+- Lucian Ciufudean - for giving me thorough feedback on the documentation, even though he's a Java freak...
+
 */
 
 }}

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-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -1,7 +1,7 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.12, 20 nov 2007
+@section changelog_cur_ver Current Version: v0.12.2, 20 nov 2007
 - removed #ifdef SINGLE_TEST from scenarios
 - added todo.html
 

Modified: sandbox/logging/boost/logging/detail/raw_doc/common_usage_steps_fd.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/common_usage_steps_fd.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/common_usage_steps_fd.hpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -13,8 +13,6 @@
 - Step 6: Define the @ref defining_your_logger "loggers" and the @ref defining_your_filter "filters" you'll use (in a source file). We need this separation
   (into declaring and defining the logs/filters), in order to @ref macros_compile_time "make compilation times fast".
 - Step 7: Add @ref boost::logging::manipulator "formatters and destinations". That is, how the message is to be formatted...
-- Step 8: @ref manipulator_use_it "Use it"
-- Step 9: Enjoy the results!
 
 */
 

Modified: sandbox/logging/boost/logging/detail/raw_doc/defining_your_logger_filter.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/defining_your_logger_filter.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/defining_your_logger_filter.hpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -3,10 +3,6 @@
 /**
 @page defining_your_logger_filter Declaring/Defining your logger/filter class(es)
 
-When using the Boost Logging Lib, you need 2 things (see @ref workflow "Workflow"):
-- a filter : which tells you if a logger is enabled or not. Note that you can use the same filter for multiple loggers - if you want.
-- a logger : which does the actual logging, once the filter is enabled
-
 
 - @ref defining_your_filter
     - @ref defining_your_filter_scenario
@@ -17,6 +13,9 @@
     - @ref defining_your_logger_use_logger
 
 
+When using the Boost Logging Lib, you need 2 things (see @ref workflow "Workflow"):
+- a filter : which tells you if a logger is enabled or not. Note that you can use the same filter for multiple loggers - if you want.
+- a logger : which does the actual logging, once it's enabled
 
 
 

Modified: sandbox/logging/boost/logging/detail/raw_doc/main.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/main.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/main.hpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -12,9 +12,11 @@
 
 Applications today are becoming increasingly complex. Part of making them easier to develop/maintain is to do logging.
 Logging allows you to later see what happened in your application. It can be a great help when debugging and/or testing it.
-The great thing about logging is that it can (and usually does) also happen at the customer site - if an error occurs,
+The great thing about logging is that you can use it on systems in production and/or in use - if an error occurs,
 by examining the log, you can get a picture of where the problem is.
 
+Good logging is mandatory in support projects, you simply can’t live without it.
+
 Used properly, logging is a very powerful tool. Besides aiding debugging/ testing, it can also show you
 how your application is used (which modules, etc.), how time-consuming certain parts of your program are,
 how much bandwidth you application consumes, etc. - it's up to you how much information you log, and where.

Modified: sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -21,9 +21,7 @@
         - gather the message
         - write the message to the destination(s)
     - if not (in other words, the log is turned off)
- - completely ignore the message
-
-The part that says "Completely ignore the message" means that <em>if the log is not enabled, no processing takes place</em>.
+ - completely ignore the message: <em>if the log is not enabled, no processing takes place</em>.
 
 For instance, say you have:
 

Added: sandbox/logging/boost/logging/detail/scoped_log.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/scoped_log.hpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,72 @@
+// scoped_log.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_scoped_log_HPP_DEFINED
+#define JT28092007_scoped_log_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+namespace boost { namespace logging {
+
+#define BOOST_LOG_CONCATENATE2(a,b) a ## b
+
+#define BOOST_LOG_CONCATENATE(a,b) BOOST_LOG_CONCATENATE2(a,b)
+
+#ifndef BOOST_LOG_USE_WCHAR_T
+
+#define BOOST_SCOPED_LOG_WITH_CLASS_NAME(logger, msg, class_name) \
+struct class_name { \
+ class_name() { logger ( "start of " msg ) ;} \
+ ~class_name() { logger ( " end of " msg ) ; } \
+} BOOST_LOG_CONCATENATE(log_, __LINE__);
+
+#define BOOST_SCOPED_LOG(logger, msg) BOOST_SCOPED_LOG_WITH_CLASS_NAME(logger, msg, BOOST_LOG_CONCATENATE(boost_scoped_log,__LINE__) )
+
+#else
+// unicode
+#define BOOST_SCOPED_LOG_WITH_CLASS_NAME(logger, msg, class_name) \
+struct class_name { \
+ class_name() { logger ( L"start of " msg ) ;} \
+ ~class_name() { logger ( L" end of " msg ) ; } \
+} BOOST_LOG_CONCATENATE(log_, __LINE__);
+
+#define BOOST_SCOPED_LOG(logger, msg) BOOST_SCOPED_LOG_WITH_CLASS_NAME(logger, msg, BOOST_LOG_CONCATENATE(boost_scoped_log,__LINE__) )
+
+#endif
+
+
+
+
+
+#define BOOST_SCOPED_LOG_CTX(logger)
+struct class_name { \
+ class_name() { logger ( "start of " msg ) ;} \
+ ~class_name() { logger ( " end of " msg ) ; } \
+ boost::logging::logger<default_,
+} BOOST_LOG_CONCATENATE(log_, __LINE__);
+
+
+
+
+
+}}
+
+#endif
+

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-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -438,6 +438,10 @@
>
                         </File>
                         <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\scoped_log.hpp"
+ >
+ </File>
+ <File
                                 RelativePath="..\..\..\..\..\boost\logging\detail\sink.hpp"
>
                         </File>

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-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -64,26 +64,34 @@
       );
  */ g_l->writer().add_destination( destination::file("out.txt") );
 }
-void your_scenario_example() {
 
- init_logs();
+#define BOOST_LOG_USEASINT2(x) #x
+#define BOOST_LOG_USEASINT(x) BOOST_LOG_USEASINT2(x)
 
- // Step 8: use it...
+#define BOOST_SCOPED_LOG_CTX(logger)
+
+/*
+#define BOOST_LOG_HOLDER2(x) x, L ## x
+#define BOOST_LOG_HOLDER(x) BOOST_LOG_HOLDER2(x)
+#define BOOST_LOG_STRTEST(x) ( BOOST_LOG_HOLDER(x) )
+*/
+
+void test(int a, const char * str) {
+// BOOST_SCOPED_LOG(LDBG, "testing inout" << a << str );
+ BOOST_SCOPED_LOG(LDBG << , "testing inout" );
+ BOOST_SCOPED_LOG(LDBG << , "testing inout2" );
     int i = 1;
     LDBG << "this is so cool " << i++ << "\n";
- LDBG << "this is so cool again " << i++;
- LERR << "first error " << i++;
-
- std::string hello = "hello", world = "world";
- LWRN << hello << ", " << world;
+}
 
- LDBG << "this will not be written anywhere";
- LWRN << "this won't be written anywhere either";
- LERR << "this error is not logged " << i++;
+void your_scenario_example() {
 
- LWRN << "good to be back ;) " << i++;
- LERR << "second error " << i++;
+ init_logs();
 
+ test(5, "cucu");
+ // Step 8: use it...
+ int i = 1;
+ LDBG << "the end" << i++ << "\n";
 }
 
 

Modified: sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -31,7 +31,7 @@
 - You want to format the message before it's written
 - The logger has several log destinations
     - The output goes to console, debug output window, and a file called out.txt - as XML
- - Formatting - prefix each message by its start time, its index, and append enter
+ - Formatting - prefix each message by its start time, its index, and append newline
 
 \n\n
 Custom classes:

Modified: sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -30,7 +30,7 @@
 - You want to format the message before it's written
 - The logger has several log destinations
     - The output goes debug output window, and a file called out.txt
- - Formatting - prefix each message by time, its index, and append enter
+ - Formatting - prefix each message by time, its index, and append newline
 
 Optimizations:
 - use a cache string (from optimize namespace), in order to make formatting the message faster

Modified: sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -27,7 +27,7 @@
 This usage:
 - You have multiple levels (in this example: debug < info < error)
 - You want to format the message before it's written
- (in this example: prefix it by index, by time, and append an enter to it)
+ (in this example: prefix it by time, by index and append newline to it)
 - You have several loggers
 - Each logger has several log destinations
 
@@ -36,11 +36,11 @@
 
 Logs:
 - Error messages go into err.txt file
- - formatting - prefix each message by time, index, and append enter
+ - formatting - prefix each message by time, index, and append newline
 - Info output goes to console, and a file called out.txt
- - formatting - prefix each message by "[app]", time, and append enter
+ - formatting - prefix each message by "[app]", time, and append newline
 - Debug messages go to the debug output window, and a file called out.txt
- - formatting - prefix each message by "[dbg]", time, and append enter
+ - formatting - prefix each message by "[dbg]", time, and append newline
 
 
 Here's how the output will look like:

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-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -26,7 +26,7 @@
 This usage:
 - You have multiple levels (in this example: debug < info < error)
 - You want to format the message before it's written
- (in this example: prefix it by index, by time, and append an enter to it)
+ (in this example: prefix it by time, by index, and append newline to it)
 - You have <b>one log</b>, which writes to several log destinations
   (in this example: the console, the debug output window, and a file)
 

Modified: sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -35,11 +35,11 @@
 
 Logs:
 - Error messages go into err.txt file
- - formatting - prefix each message by time, index, and append enter
+ - formatting - prefix each message by time, index, and append newline
 - Info output goes to console, and a file called out.txt
- - formatting - prefix each message by time, "[app]", and append enter
+ - formatting - prefix each message by time, "[app]", and append newline
 - Debug messages go to the debug output window, and the console
- - formatting - prefix each message by "[dbg]", time, and append enter
+ - formatting - prefix each message by "[dbg]", time, and append newline
 
 
 Here's how the output will look like:

Modified: sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -30,7 +30,7 @@
 - You want to format the message before it's written
 - The logger has several log destinations
     - The output goes to console, debug output window, and a file called out.txt
- - Formatting - prefix each message by its index, and append enter
+ - Formatting - prefix each message by its index, and append newline
 
 Optimizations:
 - use a cache string (from optimize namespace), in order to make formatting the message faster

Modified: sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -30,7 +30,7 @@
 - You want to format the message before it's written
 - The logger has several log destinations
     - The output goes to console, debug output window, and a file called out.txt
- - Formatting - prefix each message by its index, thread id, and append enter
+ - Formatting - prefix each message by its index, thread id, and append newline
 
 Optimizations:
 - use a cache string (from optimize namespace), in order to make formatting the message faster

Modified: sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp 2007-11-22 02:35:01 EST (Thu, 22 Nov 2007)
@@ -41,11 +41,11 @@
 
 Logs:
 - Error messages go into err.txt file
- - formatting - prefix each message by time, index, and append enter
+ - formatting - prefix each message by time, index, and append newline
 - Info output goes to console, and a file called out.txt
- - formatting - prefix each message by time and append enter
+ - formatting - prefix each message by time and append newline
 - Debug messages go to the debug output window, and the console
- - formatting - prefix each message by time, and append enter
+ - formatting - prefix each message by time, and append newline
 
 
 Here's how the output will look like:


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