Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2008-02-03 09:27:55


Author: jtorjo
Date: 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
New Revision: 43070
URL: http://svn.boost.org/trac/boost/changeset/43070

Log:
[logging]
v0.22.1, 3 feb 2008
- solved gcc warning - m_writer initialized before m_original_logger
- fixed issue in Jamfile.v2 - runtime-link should refer only to msvc

Added:
   sandbox/logging/Jamfile.v2 (contents, props changed)
   sandbox/logging/boost-build.jam (contents, props changed)
   sandbox/logging/lib/logging/samples/scenarios/run_linux.sh (contents, props changed)
   sandbox/logging/lib/logging/samples/scenarios/run_win.bat (contents, props changed)
   sandbox/logging/project-root.jam (contents, props changed)
Text files modified:
   sandbox/logging/boost/logging/detail/logger.hpp | 2
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 6 ++
   sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp | 12 ++++++
   sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp | 1
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 2
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 78 +++++++++++++++++++++++++++------------
   sandbox/logging/lib/logging/samples/scenarios/Jamfile.v2 | 2
   sandbox/logging/lib/logging/tests/Jamfile.v2 | 2
   8 files changed, 75 insertions(+), 30 deletions(-)

Added: sandbox/logging/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/logging/Jamfile.v2 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -0,0 +1,28 @@
+# Copyright Rene Rivera 2007.
+#
+# 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)
+
+# Usage:
+#
+# bjam [options | properties | targets]
+#
+# Options:
+#
+# --boost=<BOOST> The directotory of a Boost source tree.
+# Default; BOOST env var (if found)
+# Default; ../boost (if found)
+#
+# --boost-build=<BOOST_BUILD>
+# The directory for the Boost.Build v2 files.
+# Default; BOOST_BUILD_PATH env var (if found)
+# Default; BOOST_BUILD env var (if found)
+# Default; <BOOST>/tools/build/v2 (if found)
+
+#~ If we have the Boost sources we can use the project...
+
+if [ GLOB $(BOOST) : [ modules.peek project : JAMFILE ] ]
+{
+ use-project /boost : $(BOOST) ;
+}

Added: sandbox/logging/boost-build.jam
==============================================================================
--- (empty file)
+++ sandbox/logging/boost-build.jam 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -0,0 +1,21 @@
+# Copyright John Torjo 2008
+#
+# 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)
+
+
+
+local BOOST_ROOT = $(BOOST_ROOT_DIR) ;
+
+local boost-src = $(BOOST_ROOT) ;
+local boost-build-src = $(boost-src)/tools/build/v2 ;
+
+# Set some common vars to refer to the Boost sources...
+
+BOOST ?= $(boost-src) ;
+BOOST_ROOT ?= $(boost-src) ;
+
+# And load up Boost.Build...
+
+boost-build $(boost-build-src) ;

Modified: sandbox/logging/boost/logging/detail/logger.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/logger.hpp (original)
+++ sandbox/logging/boost/logging/detail/logger.hpp 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -128,7 +128,7 @@
         typedef typename boost::remove_pointer<write_msg>::type write_type;
 
         typedef logger<gather_msg, write_msg> original_logger_type;
- forward_to_logger(original_logger_type *original_logger = 0) : m_original_logger( original_logger), m_writer(0) {
+ forward_to_logger(original_logger_type *original_logger = 0) : m_writer(0), m_original_logger( original_logger) {
             if ( m_original_logger)
                 m_writer = &m_original_logger->writer();
         }

Modified: sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -1,7 +1,11 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.21.13, 1 feb 2008
+@section changelog_cur_ver Current Version: v0.22.1, 3 feb 2008
+- solved gcc warning - m_writer initialized before m_original_logger
+- fixed issue in Jamfile.v2 - runtime-link should refer only to msvc
+
+v0.21.13, 1 feb 2008
 - added known_issues section
 - added getting_started section
 - fixed scoped logs and added test

Modified: sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/miscelaneous.hpp 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -34,6 +34,18 @@
 - gcc 4.1
 
 
+@section misc_bjam Compiling with bjam
+
+You can compile the scenarios and/or tests with bjam. The easy way:
+
+- On Windows:
+ - go the the scenarios or tests directory
+ - run @c run_win.bat @em path_to_boost
+ - example: <tt>run_win d:/boosts/boost_1_34_1/ </tt>
+- On Linux
+ - go the the scenarios or tests directory
+ - run @c <tt>bash run_linux.sh <em> path_to_boost toolset</em> </tt>
+ - example: <tt>sh run_linux.sh /home/jtorjo/Desktop/boost_1_34_1/ gcc </tt>
 
 */
 

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 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -13,6 +13,7 @@
     - @ref breaking_changes
       - @ref breaking_change_v_20
     - @ref misc_compilers
+ - @ref misc_bjam
 
 - @ref getting_started
 

Modified: sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj
==============================================================================
--- sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj (original)
+++ sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -212,7 +212,7 @@
                         <Tool
                                 Name="VCLinkerTool"
                                 LinkIncremental="2"
- AdditionalLibraryDirectories="D:\boosts\boost_1_34_1\bin.v2\libs\filesystem\build\msvc-8.0\debug\link-static\threading-multi;D:\boosts\boost_1_34_1\bin.v2\libs\thread\build\msvc-8.0\debug\link-static\threading-multi\"
+ AdditionalLibraryDirectories="D:\boosts\boost_1_34_1\bin.v2\libs\filesystem\build\msvc-8.0\debug\link-static\threading-multi;D:\boosts\boost_1_34_1\bin.v2\libs\thread\build\msvc-8.0\debug\link-static\threading-multi\;D:\boosts\boost_1_34_1\bin.v2\libs\date_time\build\msvc-8.0\debug\link-static\threading-multi"
                                 GenerateDebugInformation="true"
                                 SubSystem="1"
                                 TargetMachine="1"

Modified: sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp
==============================================================================
--- sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp (original)
+++ sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -1,42 +1,70 @@
-// my_app_log.h - DECLARE your loggers & filters here
-#ifndef my_app_LOG_H_header
-#define my_app_LOG_H_header
+/**
+@example mul_levels_one_logger.cpp
 
-#include <boost/logging/format/named_write_fwd.hpp>
-// #include <boost/logging/writer/on_dedicated_thread.hpp> // uncomment if you want to do logging on a dedicated thread
+@copydoc mul_levels_one_logger
 
-namespace bl = boost::logging;
-typedef bl::named_logger<>::type logger_type;
-typedef bl::level::holder filter_type;
+@page mul_levels_one_logger mul_levels_one_logger.cpp Example
 
-BOOST_DECLARE_LOG_FILTER(g_l_level, filter_type)
-BOOST_DECLARE_LOG(g_l, logger_type)
+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 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)
+
+In this example, all output will be written to the console, debug output window, and "out.txt" file.
+It will look similar to this one:
+
+@code
+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
 
-#define L_(lvl) BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_l_level(), lvl )
+*/
 
-// initialize thy logs..
-void init_logs();
 
-#endif
-
-// my_app_log.cpp - DEFINE your loggers & filters here
-//#include "my_app_log.h"
 #include <boost/logging/format/named_write.hpp>
+typedef boost::logging::named_logger<>::type logger_type;
 
-BOOST_DEFINE_LOG_FILTER(g_l_level, filter_type )
-BOOST_DEFINE_LOG(g_l, logger_type)
+#define L_(lvl) BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), lvl )
 
+BOOST_DEFINE_LOG_FILTER(g_log_level, boost::logging::level::holder ) // holds the application log level
+BOOST_DEFINE_LOG(g_l, logger_type)
 
-void init_logs() {
+void test_mul_levels_one_logger() {
     // formatting : time [idx] message \n
     // destinations : console, file "out.txt" and debug window
     g_l()->writer().write("%time%($hh:$mm.$ss.$mili) [%idx%] |\n", "cout file(out.txt) debug");
     g_l()->mark_as_initialized();
-}
 
-void use_logger() {
     int i = 1;
- L_(debug) << "this is a simple message " << i;
- std::string hello = "hello";
- L_(info) << hello << " world";
+ L_(debug) << "this is so cool " << i++;
+ L_(error) << "first error " << i++;
+
+ std::string hello = "hello", world = "world";
+ L_(debug) << hello << ", " << world;
+
+ using namespace boost::logging;
+ g_log_level()->set_enabled(level::error);
+ L_(debug) << "this will not be written anywhere";
+ L_(info) << "this won't be written anywhere either";
+ L_(error) << "second error " << i++;
+
+ g_log_level()->set_enabled(level::info);
+ L_(info) << "good to be back ;) " << i++;
+ L_(error) << "third error " << i++;
 }
+
+
+
+int main() {
+ test_mul_levels_one_logger();
+}
+
+
+// End of file
+

Modified: sandbox/logging/lib/logging/samples/scenarios/Jamfile.v2
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/Jamfile.v2 (original)
+++ sandbox/logging/lib/logging/samples/scenarios/Jamfile.v2 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -17,7 +17,7 @@
       <include>../../../..
       <include>$(BOOST_ROOT)
       <threading>multi
- <runtime-link>static
+ <toolset>msvc:<runtime-link>static
       <link>static
       <library>/boost//thread
       <library>/boost//filesystem

Added: sandbox/logging/lib/logging/samples/scenarios/run_linux.sh
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/run_linux.sh 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -0,0 +1,4 @@
+export BOOST_ROOT_DIR="$1"
+echo Output is redirected to out.txt
+bjam --v2 --boost="$1" --toolset=$2 > out.txt 2>&1
+

Added: sandbox/logging/lib/logging/samples/scenarios/run_win.bat
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/run_win.bat 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -0,0 +1,3 @@
+set BOOST_ROOT_DIR="%1"
+echo Output is redirected to out.txt
+bjam --v2 --boost="%1" --toolset=msvc > out.txt

Modified: sandbox/logging/lib/logging/tests/Jamfile.v2
==============================================================================
--- sandbox/logging/lib/logging/tests/Jamfile.v2 (original)
+++ sandbox/logging/lib/logging/tests/Jamfile.v2 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -18,7 +18,7 @@
       <include>../../..
       <include>$(BOOST_ROOT)
       <threading>multi
- <runtime-link>static
+ <toolset>msvc:<runtime-link>static
       <link>static
       <library>/boost//thread
       <library>/boost//filesystem

Added: sandbox/logging/project-root.jam
==============================================================================
--- (empty file)
+++ sandbox/logging/project-root.jam 2008-02-03 09:27:54 EST (Sun, 03 Feb 2008)
@@ -0,0 +1,4 @@
+# Copyright 2008 John Torjo
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+


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