Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2007-10-11 12:33:46


Author: jtorjo
Date: 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
New Revision: 39930
URL: http://svn.boost.org/trac/boost/changeset/39930

Log:
added boost::logging - v0.5

Added:
   sandbox/logging/boost/
   sandbox/logging/boost/logging/
   sandbox/logging/boost/logging/defaults.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/
   sandbox/logging/boost/logging/detail/forward_constructor.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/fwd.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/
   sandbox/logging/boost/logging/detail/raw_doc/Doxyfile.txt (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/Doxyfile_web.txt (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/fixme.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/footer.html (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/footer_web.html (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/main.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/namespace_concepts.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/template.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/template.hpp (contents, props changed)
   sandbox/logging/boost/logging/detail/util.hpp (contents, props changed)
   sandbox/logging/boost/logging/error.hpp (contents, props changed)
   sandbox/logging/boost/logging/filter.hpp (contents, props changed)
   sandbox/logging/boost/logging/format/
   sandbox/logging/boost/logging/format.hpp (contents, props changed)
   sandbox/logging/boost/logging/format/array.hpp (contents, props changed)
   sandbox/logging/boost/logging/format/op_equal.hpp (contents, props changed)
   sandbox/logging/boost/logging/format/optimize.hpp (contents, props changed)
   sandbox/logging/boost/logging/level.hpp (contents, props changed)
   sandbox/logging/boost/logging/logging.hpp (contents, props changed)
   sandbox/logging/boost/logging/macros.hpp (contents, props changed)
   sandbox/logging/boost/logging/process_msg/
   sandbox/logging/boost/logging/process_msg.hpp (contents, props changed)
   sandbox/logging/boost/logging/process_msg/ostream_like.hpp (contents, props changed)
   sandbox/logging/boost/logging/sink.hpp (contents, props changed)
   sandbox/logging/boost/logging/ts/
   sandbox/logging/boost/logging/ts/ts.hpp (contents, props changed)
   sandbox/logging/boost/logging/ts/ts_boost.hpp (contents, props changed)
   sandbox/logging/boost/logging/ts/ts_none.hpp (contents, props changed)
   sandbox/logging/boost/logging/ts/ts_posix.hpp (contents, props changed)
   sandbox/logging/boost/logging/ts/ts_resource.hpp (contents, props changed)
   sandbox/logging/boost/logging/ts/ts_win32.hpp (contents, props changed)
   sandbox/logging/boost/logging/writer/
   sandbox/logging/boost/logging/writer/format_write.hpp (contents, props changed)
   sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp (contents, props changed)
   sandbox/logging/boost/logging/writer/ts_write.hpp (contents, props changed)
   sandbox/logging/generating the docs.txt (contents, props changed)
   sandbox/logging/lib/
   sandbox/logging/lib/logging/
   sandbox/logging/lib/logging/doc/
   sandbox/logging/lib/logging/doc/html/
   sandbox/logging/lib/logging/doc/html/dummy.txt (contents, props changed)
   sandbox/logging/lib/logging/samples/
   sandbox/logging/lib/logging/samples/vc8/
   sandbox/logging/lib/logging/samples/vc8/loggingvc8/
   sandbox/logging/lib/logging/samples/vc8/loggingvc8/ReadMe.txt (contents, props changed)
   sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.sln (contents, props changed)
   sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.vcproj (contents, props changed)
   sandbox/logging/lib/logging/samples/vc8/loggingvc8/stdafx.cpp (contents, props changed)
   sandbox/logging/lib/logging/samples/vc8/loggingvc8/stdafx.h (contents, props changed)
   sandbox/logging/lib/logging/samples/vc8/template.cpp (contents, props changed)
   sandbox/logging/lib/logging/src/
   sandbox/logging/lib/logging/src/changelog.txt (contents, props changed)
   sandbox/logging/lib/logging/src/dummy.txt (contents, props changed)
   sandbox/logging/lib/logging/tests/
   sandbox/logging/lib/logging/tests/format/
   sandbox/logging/lib/logging/tests/format/test_format_write_ts.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/format/test_manip_being_func.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/format/test_manip_w_msgroute.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/format/test_simple_formatter.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/template.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/test_mul_lev_difflogs.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/test_mul_lev_samelog.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/test_multiple_simple_logs.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/test_ostream_like.cpp (contents, props changed)
   sandbox/logging/lib/logging/tests/test_simple_dump_to_cout.cpp (contents, props changed)

Added: sandbox/logging/boost/logging/defaults.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/defaults.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,104 @@
+// defaults.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_defaults_HPP_DEFINED
+#define JT28092007_defaults_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/ts/ts.hpp>
+#include <boost/logging/ts/ts_resource.hpp>
+
+#include <string>
+
+
+namespace boost { namespace logging {
+
+/**
+@page override_defaults Defaults, and overriding them.
+
+The logging lib has a few default types, used throughout the lib. They are:
+- @c char_type - the char type used throught the lib; by default, it's @c char
+- @c hold_string_type - the type used to hold a string; by default, it's @c std::string
+- @c filter_type - the default filter; by default, it's filter::no_ts
+- @c lock_resource - used to lock resources for access. See locker namespace.
+
+They are all present in @c default_types structure.
+
+If you want to override any of the above, you should do the following:
+- before including anything from Boost Logging Library, <tt>\#include <boost/logging/defaults.hpp> </tt>
+- override the types
+- do <tt>\#include <boost/logging/logging.hpp> </tt>
+
+Example:
+
+@code
+ #include <boost/logging/defaults.hpp>
+
+ namespace boost { namespace logging {
+ struct types<override> {
+ // define your types
+ typedef wchar_t char_type;
+ // etc.
+ };
+ }}
+
+ #include <boost/logging/logging.hpp>
+@endcode
+
+
+*/
+
+
+
+ struct override {};
+
+ // forward defines
+
+ namespace filter {
+ struct no_ts;
+ };
+
+ struct default_types {
+ typedef char char_type;
+ // this is the type we use to hold a string, internally
+ typedef std::string hold_string_type;
+
+ // default filter type
+ typedef filter::no_ts filter_type;
+
+ struct lock_resource {
+ template<class lock_type> struct finder {
+ typedef typename locker::ts_resource<lock_type> type;
+ };
+ };
+
+
+ };
+
+ // FIXME we need defaults for different scenarios!
+ template<class T> struct types : default_types {
+ };
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/detail/forward_constructor.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/forward_constructor.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,80 @@
+// forward_constructor.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_forward_constructor_HPP_DEFINED
+#define JT28092007_forward_constructor_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <boost/config.hpp>
+
+//#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
+
+#ifdef BOOST_MSVC
+// because of copy-constructor bug
+#include <boost/type_traits/is_base_of.hpp>
+#endif
+
+namespace boost { namespace logging {
+
+#define BOOST_LOGGING_FORWARD_CONSTRUCTOR(class_name,forward_to) \
+ template<class p1> class_name(const p1 & a1 ) : forward_to(a1) {} \
+ template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(a1,a2) {} \
+ template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(a1,a2,a3) {} \
+ template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(a1,a2,a3,a4) {} \
+ template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(a1,a2,a3,a4,a5) {}
+
+
+
+#ifdef BOOST_MSVC
+// workaround for VS - problem with copy constructor
+
+#define BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW(class_name,forward_to,type) \
+ template<class p1> class_name(const p1 & a1 ) { \
+ see_if_copy_constructor( a1, forward_to, boost::is_base_of<class_name,p1>() ); \
+ } \
+ template<class p1, class forward_type> void see_if_copy_constructor(const p1 & a1, forward_type&, const boost::true_type& ) { \
+ forward_to = a1.forward_to; \
+ } \
+ template<class p1, class forward_type> void see_if_copy_constructor(const p1 & a1, forward_type&, const boost::false_type& ) { \
+ forward_to = forward_type(new type(a1)); \
+ } \
+ template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(new type(a1,a2)) {} \
+ template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(new type(a1,a2,a3)) {} \
+ template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(new type(a1,a2,a3,a4)) {} \
+ template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(new type(a1,a2,a3,a4,a5)) {}
+
+#else
+#define BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW(class_name,forward_to,type) \
+ template<class p1> class_name(const p1 & a1 ) : forward_to(new type(a1)) {} \
+ template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(new type(a1,a2)) {} \
+ template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(new type(a1,a2,a3)) {} \
+ template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(new type(a1,a2,a3,a4)) {} \
+ template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(new type(a1,a2,a3,a4,a5)) {}
+
+#endif
+
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/detail/fwd.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/fwd.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,65 @@
+// fwd.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_fwd_HPP_DEFINED
+#define JT28092007_fwd_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/ts/ts.hpp>
+#include <boost/logging/ts/ts_resource.hpp>
+#include <boost/logging/detail/util.hpp>
+
+#include <boost/logging/defaults.hpp>
+
+// minimize inclusion of STL headers in our headers!!!
+#include <string>
+
+
+
+
+/*
+ Important: we define here only the things that are needed by ALL OF THE LIBRARY.
+ So be very careful when modifying this file - we don't want any circular dependencies!
+
+ If unsure where to place something, place it logging.hpp!
+*/
+
+namespace boost { namespace logging {
+ // see our types
+ typedef types<override>::char_type char_type;
+ typedef types<override>::hold_string_type hold_string_type;
+ typedef types<override>::filter_type filter_type;
+
+ namespace writer {};
+
+
+
+ /**
+ just in case you're doing a typo - "write" instead of "writer"
+ */
+ namespace write = writer;
+}}
+
+
+#endif
+

Added: sandbox/logging/boost/logging/detail/raw_doc/Doxyfile.txt
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/Doxyfile.txt 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,267 @@
+# Doxyfile 1.5.3
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = "Boost Logging Library v2 "
+PROJECT_NUMBER =
+OUTPUT_DIRECTORY = ../../../../lib/logging/doc
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class " \
+ "The $name widget " \
+ "The $name file " \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = ../..
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_CLASSES = YES
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = NO
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = NO
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text "
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ../..
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.d \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.idl \
+ *.odl \
+ *.cs \
+ *.php \
+ *.php3 \
+ *.inc \
+ *.m \
+ *.mm \
+ *.dox \
+ *.py
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER = footer.html
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+HTML_DYNAMIC_SECTIONS = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+MSCGEN_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO

Added: sandbox/logging/boost/logging/detail/raw_doc/Doxyfile_web.txt
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/Doxyfile_web.txt 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,267 @@
+# Doxyfile 1.5.3
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = "Boost Logging Library v2 "
+PROJECT_NUMBER =
+OUTPUT_DIRECTORY = ../../../../../../../torjo.com/log2/doc
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class " \
+ "The $name widget " \
+ "The $name file " \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = ../..
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_CLASSES = YES
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = NO
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = NO
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text "
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ../..
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.d \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.idl \
+ *.odl \
+ *.cs \
+ *.php \
+ *.php3 \
+ *.inc \
+ *.m \
+ *.mm \
+ *.dox \
+ *.py
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER = footer_web.html
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+HTML_DYNAMIC_SECTIONS = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+MSCGEN_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO

Added: sandbox/logging/boost/logging/detail/raw_doc/fixme.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/fixme.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,21 @@
+/*
+compile all!
+
+about process_msg
+about macros - macros.hpp -> have specific page
+about non_const_context
+
+about formatting
+about thread-safety
+
+
+writer namespace , etc.
+compilers
+where the code is - boost-sandbox
+
+
+overriding defaults
+
+
+
+*/
\ No newline at end of file

Added: sandbox/logging/boost/logging/detail/raw_doc/footer.html
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/footer.html 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,10 @@
+<hr>
+<br>
+<small> Copyright John Torjo &copy; 2007
+</small> <br>
+
+<small> Have a question/ suggestion/ comment? Send me feedback
+</small>
+
+</body>
+</html>

Added: sandbox/logging/boost/logging/detail/raw_doc/footer_web.html
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/footer_web.html 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,18 @@
+<hr>
+<br>
+<small> Copyright John Torjo &copy; 2007
+</small> <br>
+
+<small> Have a question/ suggestion/ comment? Send me feedback
+</small>
+
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "UA-2606226-1";
+urchinTracker();
+</script>
+
+</body>
+</html>

Added: sandbox/logging/boost/logging/detail/raw_doc/main.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/main.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,184 @@
+namespace boost { namespace logging {
+
+/**
+@page main_intro Boost Logging Library v2 : Introduction
+
+- @ref main_motivation
+- @ref main_examples
+
+@section main_motivation Motivation
+
+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,
+by examining the log, you can get a picture of where the problem is.
+
+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.
+
+The Boost Log Library has these features:
+- A simple and clear separation of concepts
+ - concepts are also easily separated into namespaces
+- A very flexible interface
+- You don't pay for what you don't use.
+- Fits a lot of scenarios: from very simple (dumping all to one log)
+ to very complex (multiple logs, some enabled/some not, levels, etc).
+- Allows you to choose how you use logs in your code (by defining your own LOG_ macros, suiting your application)
+- Allows you to use Log levels (debug, error, fatal, etc). However this is an orthogonal concept - the library
+ will work whether you use levels, categories or whatever , or not.
+- Efficient filtering of log messages - that is, if a log is turned off, the message is not processed at all
+- Thread-safe - the library allows you several degrees of thread-safety, as you'll see
+- Allows for formatters and destinations
+ - formatters format the message (like, prepending extra information - an index, the time, thread is, etc)
+ - destinations specify where the message is to be written
+ - Formatters and Destinations are orthogonal to the rest of the library - if you want you can use them, otherwise
+ you can define your own writing mechanism
+- Easy manipulation of the logs (turning on/off, setting formatters, destinations, etc)
+
+
+@section main_examples Examples
+
+To see all its power, here are a few examples:
+
+
+
+\n\n
+Example 1: you choose to use the <i>L_(msg)</i> sytax:
+
+@code
+#include <boost/logging/logging.hpp>
+
+using namespace boost::logging;
+struct write_to_cout_and_file { ... };
+
+// defining the logs
+logger<write_to_cout_and_file, filter::no_ts> g_single_log("out.txt");
+#define L_(x) if ( g_single_log) g_single_log.process_msg()(x)
+
+// code
+L_("reading word " + word);
+@endcode
+
+
+
+\n\n
+Example 2: you choose to use the <i>L_ << "some " << " cool " << "log message"</i> syntax
+
+@code
+#include <boost/logging/logging.hpp>
+#include <boost/logging/process_msg.hpp>
+
+struct write_to_file { ... };
+struct write_to_cout { ... };
+struct write_to_dbg { ... };
+
+using namespace boost::logging;
+
+// defining the logs
+typedef process_msg< gather::ostream_like::return_str<>, write_to_cout> processor_cout;
+typedef process_msg< gather::ostream_like::return_str<>, write_to_file> processor_file;
+typedef process_msg< gather::ostream_like::return_str<>, write_to_dbg> processor_dbg;
+
+logger<processor_cout, filter::no_ts> g_log_app;
+logger<processor_file, filter::no_ts> g_log_err("err.txt");
+logger<processor_dbg, filter::no_ts> g_log_dbg;
+
+#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()
+
+// code
+LAPP_ << idx << " : reading word " << word;
+LERR_ << "error at " << idx << ", while reading " << word;
+LDBG_ << "debug info: " << idx << ", reading " << word;
+@endcode
+
+
+
+\n\n
+Example 3: you choose to use the same syntax as Example 2, but also use formatters and destinations.
+
+@code
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format/optimize.hpp>
+#include <boost/logging/process_msg/ostream_like.hpp>
+#include <boost/logging/format.hpp>
+
+using namespace boost::logging;
+
+...
+
+typedef optimize::cache_string_one_str<> cache_string;
+typedef process_msg<
+ gather::ostream_like::return_cache_str<> ,
+ format_write<
+ format_base,
+ destination_base, format_and_write::simple<cache_string> > > process;
+logger<process, filter::no_ts> g_l;
+
+#define L_ if ( !g_l) ; else g_l->read_msg().gather().out()
+
+int main() {
+ // add formatters : [idx] [time] message [enter]
+ g_l->writer().add_formatter( write_idx() );
+ g_l->writer().add_formatter( write_time() );
+ g_l->writer().add_formatter( append_enter() );
+
+ // write to cout and file
+ g_l->writer().add_destination( write_to_cout() );
+ g_l->writer().add_destination( write_to_file("out.txt") );
+
+ int i = 1;
+ L_ << "will be prefixed by index and time , enter is appended as well " << i++;
+}
+
+@endcode
+
+
+
+\n\n
+Example 4: you choose to use levels
+
+@code
+using namespace boost::logging;
+
+struct write_to_file { ... };
+
+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 info goes into "dbg.txt" file
+// error info goes into "err.txt" file
+// app info goes into "out.txt" file
+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()
+
+int main() {
+ // set level at this time, print everything
+ level_holder.set_enabled(level::info);
+ ...
+ LAPP_ << "info at : " << idx << " : reading word " << word;
+ ...
+ // only errors and above
+ level_holder.set_enabled(level::error);
+ LDBG_ << "this will not be printed";
+}
+
+@endcode
+
+
+*/
+
+}}

Added: sandbox/logging/boost/logging/detail/raw_doc/namespace_concepts.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/namespace_concepts.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,52 @@
+namespace boost { namespace logging {
+
+/**
+@page namespace_concepts Concepts as namespaces
+
+- @ref namespace_general
+- @ref namespace_manipulator
+- @ref namespace_write
+
+This library uses a few concepts.
+
+Take filter, for instance. It's a very simple concept - it only requires the <tt>bool is_enabled() const;</tt> function to be present.
+
+Each concept can be implemented in several ways. To make it easier for you, <b>each concept is a namespace</b>.
+In the given namespace, you'll find possible implementations of that concept. Of course, to those implementations, you can add your own ;)
+
+\n\n
+@section namespace_general General contepts
+- filter - available filter implementations
+- level - in case you want to use Log Levels
+- writer - %writer objects; they do the actual write of the message
+
+
+\n\n
+@section namespace_process Processing the message
+(for more info, see process_msg class)
+- gather - gathering the message
+- writer - %writer objects; they do the actual write of the message
+- gather::ostream_like - (related to gathering the message) allows gathering the message using the cool operator<< (@ref workflow_2a)
+
+
+\n\n
+@section namespace_manipulator Manipulator contepts
+- manipulator - what a manipulator is: a formatter or a destination
+- formatter - available formatters
+- destination - available destinations
+
+
+\n\n
+@section namespace_write Writing contepts
+- format_and_write - contains the logic for formatting and writing to destinations
+- msg_route - contains the logic for routing the message to the formatters and destinations
+- op_equal - implements operator==, in order to compare formatters and/or destinations. Useful when you want to
+ erase formatters/destinations from a logger.
+- optimize - (related to gathering the message) optimizes holding the message, as it's formatted. Formatting can modify the message.
+ Implementations from this namespace allow optimizing the medium so that modifying the message is as fast as possible
+
+
+
+*/
+
+}}

Added: sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/table_of_contents.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,40 @@
+namespace boost { namespace logging {
+
+/**
+@mainpage Boost Logging Library v2 - Table of contents
+
+- @ref main_intro
+ - @ref main_motivation
+ - @ref main_examples
+- @ref workflow
+ - @ref workflow_introduction
+ - @ref workflow_filter
+ - @ref workflow_processing
+ - @ref workflow_2a
+ - @ref workflow_2b
+- @ref namespace_concepts
+ - @ref namespace_general
+ - @ref namespace_process
+ - @ref namespace_manipulator
+ - @ref namespace_write
+- @ref logger "The logger class"
+- @ref filter "The filters (namespace)"
+- @ref process_msg "The process message class"
+ - @ref gather "The gather namespace"
+ - @ref writer "The writer namespace"
+- @ref manipulator "Formatters and/or destinations (manipulators namespace)"
+ - @ref manipulator_base
+ - @ref share_data
+
+- @ref thread_safety
+
+- @ref override_defaults
+
+
+- @ref macros
+
+
+
+*/
+
+}}

Added: sandbox/logging/boost/logging/detail/raw_doc/template.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/template.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,9 @@
+namespace boost { namespace logging {
+
+/**
+@page template title
+
+
+*/
+
+}}

Added: sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,192 @@
+namespace boost { namespace logging {
+
+/**
+@page workflow Logging workflow
+
+
+- @ref workflow_introduction
+- @ref workflow_filter
+- @ref workflow_processing
+- @ref workflow_2a
+- @ref workflow_2b
+
+
+
+
+@section workflow_introduction Introduction
+
+So, what happens when a message is written to the log?
+
+First, you have a logger you write to. @b Every logger contains 2 things:
+- a filter, which indicates if the log is turned on or off
+- a processor, which will process the message, in case the log is turned on.
+
+Whenever you create a logger, you specify the filter and the processor as template parameters:
+
+@code
+// filter is optional - there is a default
+logger< the_processor, the_filter> g_l;
+@endcode
+
+Example:
+
+@code
+using namespace boost::logging;
+logger<write_to_cout, filter::no_ts> g_log;
+@endcode
+
+
+
+@section workflow_filter Step 1: Filtering the message
+
+So, first time the message is filtered. The filter class only needs to provide the @c is_enabled function.
+Then, the logger provides 2 helpers:
+- operator bool()
+- operator !
+
+Thus, in your code, you can easily find out if a logger is enabled or not:
+
+@code
+logger<write_to_cout, filter::no_ts> g_log;
+
+// code
+if ( g_log) do_something(g_log);
+
+// or
+if ( !g_log) ; else do_something...
+@endcode
+
+Usually, you won't write code like above - instead, you'll hide all the above with @ref macros "macros".
+
+Anyway, the end result is that logging is efficient - processing the message happens <b>only if</b> the filter is enabled.
+Otherwise, processing is @em completely ignored.
+
+
+
+@section workflow_processing Step 2: Processing the message
+
+So, once we've established that the logger is enabled, we'll @em process the message.
+Processing means whatever your application thinks logging means.
+
+This can be as simple as dumping the message to cout or whatever.
+
+Example:
+
+@code
+struct write_to_cout {
+ void operator()(const std::string & msg) const {
+ std::cout << msg << std::endl ;
+ }
+};
+
+using namespace boost::logging;
+logger<write_to_cout, filter::no_ts> g_single_log;
+
+#define L_(x) if ( g_single_log) g_single_log.process_msg()(x)
+
+// usage
+L_("reading word " + word);
+@endcode
+
+As you can see, processing the message means having a functor which implements operator(). You can be happy with something similar to the above. Or...
+
+If you think about it, you can actually divide this step, into 2 smaller steps:
+- gathering the message
+- writing the message
+
+
+
+\n\n
+@section workflow_2a Step 2A: Gathering the message
+
+The meaning of "gathering the message" dependends on your application. The message can:
+- be a simple string,
+- it can contain extra info, like: level, category, etc.
+- it can be written all at once, or using the cool "<<" operator
+- or any combination of the above
+
+Depending on your needs, gathering can be complex or not. However, it's completely decoupled from the other steps.
+Gathering goes hand in hand with @ref macros "macros".
+
+The cool thing is that you decide how the <i>Logging syntax</i> is - depending on how you want to gather the message.
+All of the below are viable options:
+
+@code
+L_("reading " + word);
+L_ << "this " << " is " << "cool";
+L_(dbg) << "happily debugging";
+L_(err,"chart")("Cannot load chart")(chart_path);
+@endcode
+
+How you gather your message, depends on how you <tt>\#define L_ ...</tt>.
+
+So, in other words, gathering the message means getting all the message in "one piece", so that it can further be written.
+
+
+
+
+\n\n
+@section workflow_2b Step 2B: Writing the message
+
+Now that you have the message, you're ready to write it. Again, writing is done by calling operator() on the writer object.
+
+What you choose as the writer object is completely up to you. It can be as simple as this:
+
+@code
+// dump message to cout
+
+struct write_to_cout {
+ void operator()(const std::string & msg) const {
+ std::cout << msg << std::endl ;
+ }
+};
+
+typedef process_msg< gather::ostream_like::return_str<>, write_to_cout> processor;
+logger<processor, filter::no_ts> g_single_log;
+
+#define L_ if ( !g_single_log) ; else g_single_log->read_msg().gather().out()
+
+// usage
+L_ << idx << " : reading word " << word;
+@endcode
+
+You can define your own types of writers. At this time, the %writer classes that come with this library are in <tt>namespace writer</tt>.
+
+At this time, I've defined the concept of writer::format_write - writing using Formatters and Destinations.
+Simply put, this means formatting the message, and then writing it to destination(s).
+
+For each log, you decide where how messages are formatted, and to what destinations they are written. Example:
+
+@code
+typedef process_msg< gather::ostream_like::return_cache_str<> ,
+ format_write< format_base, destination_base, format_and_write::simple<cache_string> > > process;
+logger<process, filter::no_ts> g_l;
+
+#define L_ if ( !g_l) ; else g_l->read_msg().gather().out()
+
+// add formatters : [idx] [time] message [enter]
+g_l->writer().add_formatter( write_idx() );
+g_l->writer().add_formatter( write_time() );
+g_l->writer().add_formatter( append_enter() );
+
+// write to cout and file
+g_l->writer().add_destination( write_to_cout() );
+g_l->writer().add_destination( write_to_file("out.txt") );
+
+
+// usage
+int i = 1;
+L_ << "testing " << i++;
+
+// the above message will be formatted like this : "[1] 22:30 testing 1\n",
+// and will be dumped to cout and "out.txt" file.
+@endcode
+
+
+
+
+
+
+*/
+
+}}

Added: sandbox/logging/boost/logging/detail/template.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/template.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,35 @@
+// Template.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_TEMPLATE_HPP_DEFINED
+#define JT28092007_TEMPLATE_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/util.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/detail/util.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,52 @@
+// detail/util.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_detail_util_HPP_DEFINED
+#define JT28092007_detail_util_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+/*
+ make sure we don't need any of our headers included from here!
+ we're included from fwd.hpp!
+*/
+
+namespace boost { namespace logging {
+ template<class type> struct type_as_arg {};
+
+
+ /*
+ it makes sure this value gets created before it's used
+ */
+ template<class type> struct ensure_created_before_used {
+ // FIXME I need to figure out how to do this - probably by just holding char[sizeof(T) * 2] or so - align it and that's it and have an extra bool
+ ensure_created_before_used(const type & val = type() ) : val(val) {}
+ type & operator()() { return *this; }
+ const type & operator()() { return *this; }
+ private:
+ type val;
+ };
+
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/error.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/error.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,35 @@
+// error.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// 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/filter.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/filter.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,295 @@
+// filter.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// 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>
+
+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_tls_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 true; }
+};
+
+
+/**
+ 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;
+};
+
+/**
+ Uses TLS (Thread Local 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)
+*/
+struct use_tls_with_cache {
+ typedef locker::tls_resource_with_cache<bool> data;
+
+ use_tls_with_cache(int cache_millis) : m_enabled(true, cache_millis) {}
+ 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;
+};
+
+} // namespace filter
+
+ namespace detail {
+ template<class type> struct process_msg_holder {
+ process_msg_holder() {}
+
+ BOOST_LOGGING_FORWARD_CONSTRUCTOR(process_msg_holder, m_processor)
+
+ type const & process_msg() const { return m_processor; }
+ type & process_msg() { return m_processor; }
+ private:
+ type m_processor;
+ };
+ }
+
+ /**
+ @brief Helper, used to initialize both filter and process_msg_holder, from a logger.
+
+ Example:
+
+ @code
+ logger<...> l(init_both, param_to_initialize_process, param_to_initialize_filter);
+ @endcode
+ */
+ struct init_both_t {};
+ namespace { init_both_t init_both; }
+
+ /**
+ @brief The logger class. Every log from your application is an instance of this.
+
+ The logger has a filter, and a message processor, which will process the message if the log is enabled
+ (@ref workflow "see workflow")
+
+ The logger derives from the filter, so you can manipulate it as a %filter (enable/disable it, if the %filter allows it)
+ In addition to that, it implements the bool() and ! (not) operator, which just return whether the log is enabled or not:
+
+ @code
+ logger<write_to_cout> g_log;
+
+ // usage
+ if ( g_log) do_something(g_log);
+ if ( !g_log) ; else do_something(g_log);
+ @endcode
+
+ The logger owns an instance of @c process_msg_type, and allows access to it through @c process_msg function, or through @c operator->
+
+ @code
+ logger<write_to_cout> g_log;
+ g_log.process_msg().some_method(...);
+ g_log->some_method(...)
+ @endcode
+
+ By default, when constructed, the logger forwards all arguments to the process_msg instance. However, you can initialize both
+ the filter and the process_msg at the same time, like this:
+
+ @code
+ logger<...> l(init_both, param_to_initialize_process, param_to_initialize_filter);
+ @endcode
+
+ The logger always forwards all message processing to the @c process_msg_type class (see process_msg). Basically, usage through @ref macros "macros" is:
+
+ @code
+ logger<...> g_log;
+
+ #define L_ if ( !g_log) ; else g_log.process_msg().do_processing...;
+ // OR
+ #define L_ if ( !g_log) ; else g_log->do_processing...;
+
+ // usage
+ L_ << "cool " << "message";
+ @endcode
+
+ \n\n
+
+ @param process_msg_type The message processor. It can be any class that will process the message.
+ How the class does the actual processing is up to you - also, based on that you'll @ref macros "define your macro(s)".
+ For non-trivial cases, it should be the process_msg class.
+
+ @param filter [optional] The filter that says if the log is enabled or not. If not specified, the @ref override_defaults "default is used".
+ */
+ template<class process_msg_type , class filter = filter_type> struct logger : filter, detail::process_msg_holder<process_msg_type> {
+ typedef detail::process_msg_holder<process_msg_type> process_base;
+
+ logger() {}
+
+ /**
+ */
+ template<class p1, class p2> logger(const init_both_t&, p1 a1, p2 a2) : process_base(a1), filter(a2) {}
+
+
+ BOOST_LOGGING_FORWARD_CONSTRUCTOR(logger, process_base)
+
+ operator bool() const { return is_enabled(); }
+ bool operator!() const { return !is_enabled(); }
+
+ /**
+ Syntactic sugar. Allow writing <tt>logger->some_method(x);</tt>, which is equivalent to
+ <tt>logger.process_msg().some_method(x);</tt>
+ */
+ const process_msg_type* operator->() const { return &process_msg(); }
+ process_msg_type* operator->() { return &process_msg(); }
+
+ };
+
+
+
+}}
+
+
+#endif
+

Added: sandbox/logging/boost/logging/format.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/format.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,829 @@
+// format.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_format_HPP_DEFINED
+#define JT28092007_format_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/format/op_equal.hpp>
+#include <boost/logging/format/array.hpp>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+namespace boost { namespace logging {
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Format and write
+ //
+
+ /**
+ @brief The @c %format_and_write classes know how to call the formatter and destination @c objects.
+
+ Usually you'll be happy with the
+ format_and_write::simple class - which simply calls @c operator() on the formatters , and @c operator() on the destinations.
+
+ Note that usually the formatter and destination class just have an @c operator(), which when called, formats the message
+ or writes it to a destination. In case your formatters/destinations are more complex than that (for instance, more than
+ a member function needs to be called), you'll have to implement your own %format_and_write class.
+ */
+ namespace format_and_write {
+
+ /**
+ @brief This uses a cache, when calling formatters/destinations - for writing a given message
+
+ If a message was formatted before, it caches this info.
+
+ FIXME this is not implemented yet
+ */
+ template<class formatter_base, class destination_base, class msg_type>
+ struct use_cache {
+ use_cache( msg_type & msg) : m_msg(msg) {}
+
+#if 0
+ void format(const formatter_ptr & fmt) {
+ // FIXME
+ }
+ void write(const destination_ptr & dest) {
+ // FIXME
+ }
+ void clear_format() {
+ // FIXME
+ }
+#endif
+ private:
+ msg_type &m_msg;
+ };
+
+
+ /**
+ @brief Formats the message, and writes it to destinations - calls @c operator() on the formatters , and @c operator() on the destinations. Ignores @c clear_format() commands.
+
+ @param msg_type The message to pass to the formatter. This is the type that is passed to the formatter objects and to the destination objects.
+ Thus, it needs to be convertible to the argument to be sent to the formatter objects and to the argument to be sent to the destination objects.
+ Usually, it's the argument you pass on to your destination classes.
+
+ If you derive from @c destination::base, this type can be @c destination::base::raw_param (see below).
+
+ Example:
+
+ @code
+ typedef destination::base<const std::string &> dest_base;
+ // in this case : msg_type = std::string = dest_base::raw_param
+ struct write_to_cout : dest_base {
+ void operator()(param msg) const {
+ std::cout << msg ;
+ }
+ };
+
+
+ typedef destination::base<const std::string &> dest_base;
+ // in this case : msg_type = cache_string = dest_base::raw_param
+ struct write_to_file : dest_base, ... {
+ void operator()(param msg) const {
+ context() << msg ;
+ }
+ };
+
+ @endcode
+ */
+ template<class msg_type>
+ struct simple {
+ simple ( msg_type & msg) : m_msg(msg) {}
+
+ template<class formatter_ptr> void format(const formatter_ptr & fmt) {
+ (*fmt)(m_msg);
+ }
+ template<class destination_ptr> void write(const destination_ptr & dest) {
+ (*dest)(m_msg);
+ }
+ void clear_format() {}
+ protected:
+ msg_type &m_msg;
+ };
+
+
+ /**
+ @brief Formats the message, and writes it to destinations - calls @c operator() on the formatters , and @c operator() on the destinations.
+
+ Cares for the @c clear_format() commands.
+
+ @param msg_type The message to pass to the formatter. This is the type that is passed to the formatter objects and to the destination objects.
+ Thus, it needs to be convertible to the argument to be sent to the formatter objects and to the argument to be sent to the destination objects.
+ Usually, it's the argument you pass on to your destination classes.
+
+ If you derive from @c destination::base, this type can be @c destination::base::raw_param (see below).
+
+ @param string_type [optional] A class that can hold a string (that is, a copy of the message)
+
+ Example:
+
+ @code
+ typedef destination::base<const std::string &> dest_base;
+ // in this case : msg_type = std::string = dest_base::raw_param
+ struct write_to_cout : dest_base {
+ void operator()(param msg) const {
+ std::cout << msg ;
+ }
+ };
+
+
+ typedef destination::base<const std::string &> dest_base;
+ // in this case : msg_type = cache_string = dest_base::raw_param
+ struct write_to_file : dest_base, ... {
+ void operator()(param msg) const {
+ context() << msg ;
+ }
+ };
+
+ @endcode
+
+ */
+ template<class msg_type, class string_type = hold_string_type>
+ struct simple_care_for_clear_format : simple<msg_type> {
+ typedef simple<msg_type> simple_base_type;
+
+ simple_care_for_clear_format( msg_type & msg) : simple_base_type(msg), m_original_msg( msg ) {}
+
+ void clear_format() {
+ m_msg = m_original_msg;
+ }
+ private:
+ msg_type m_original_msg;
+ };
+
+ } // namespace format_and_write
+
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Message routing
+ //
+
+ /**
+ @brief Specifies the route : how formatting and writing to destinations take place.
+
+ Classes in this namespace specify when formatters and destinations are to be called.
+
+ @sa msg_route::simple, msg_route::with_route
+
+ */
+ namespace msg_route {
+
+ /**
+ @brief Recomended base class for message routers that need access to the underlying formatter and/or destination array.
+ */
+ template<class formatter_array, class destination_array>
+ struct formatter_and_destination_array_holder {
+ protected:
+ formatter_and_destination_array_holder (const formatter_array & formats, const destination_array & destinations)
+ : m_formats(formats), m_destinations(destinations) {}
+
+ const formatter_array & formats() const { return m_formats; }
+ const destination_array & destinations() const { return m_destinations; }
+
+ private:
+ const formatter_array & m_formats;
+ const destination_array & m_destinations;
+ };
+
+ /**
+ @brief Represents a simple router - first calls all formatters - in the order they were added, then all destinations - in the order they were added
+
+ Example:
+
+@code
+typedef process_msg< gather::ostream_like::return_cache_str<> , format_write<...> > process;
+logger<process, filter::no_ts> g_l;
+#define L_ if ( !g_l) ; else g_l->read_msg().gather().out()
+
+// add formatters : [idx] [time] message [enter]
+g_l->writer().add_formatter( write_idx() );
+g_l->writer().add_formatter( write_time() );
+g_l->writer().add_formatter( append_enter() );
+
+// write to cout and file
+g_l->writer().add_destination( write_to_cout() );
+g_l->writer().add_destination( write_to_file("out.txt") );
+
+// usage
+int i = 1;
+L_ << "testing " << i << i+1 << i+2;
+@endcode
+
+ In the above case, @c write_idx() is called, then @c write_time(), then @c append_enter(). Now, the destinations are called:
+ @c write_to_cout(), and then @c write_to_file().
+
+
+
+@param format_base The base class for all formatter classes from your application. See manipulator.
+
+@param destination_base The base class for all destination classes from your application. See manipulator.
+
+ */
+ template<
+ class formatter_base,
+ class destination_base >
+ struct simple {
+ typedef typename formatter_base::ptr_type formatter_ptr;
+ typedef typename destination_base::ptr_type destination_ptr;
+
+ typedef std::vector<formatter_ptr> f_array;
+ typedef std::vector<destination_ptr> d_array;
+ struct write_info {
+ f_array formats;
+ d_array destinations;
+ };
+
+ typedef typename boost::logging::types<override>::lock_resource::finder<write_info>::type data;
+
+ template<class formatter_array, class destination_array> simple(const formatter_array&, const destination_array&) {}
+
+ void append_formatter(formatter_ptr fmt) {
+ data::write to_write(m_to_write);
+ to_write->formats.push_back(fmt);
+ }
+ void del_formatter(formatter_ptr fmt) {
+ data::write to_write(m_to_write);
+ f_array::iterator del = std::remove(to_write->formats.begin(), to_write->formats.end(), fmt);
+ to_write->formats.erase(del, to_write->formats.end());
+ }
+
+ void append_destination(destination_ptr dest) {
+ data::write to_write(m_to_write);
+ to_write->destinations.push_back(dest);
+ }
+
+ void del_destination(destination_ptr dest) {
+ data::write to_write(m_to_write);
+ d_array::iterator del = std::remove(to_write->destinations.begin(), to_write->destinations.end(), dest);
+ to_write->destinations.erase(del, to_write->destinations.end());
+ }
+
+ template<class format_and_write, class msg_type> void write(msg_type & msg) const {
+ format_and_write m(msg);
+
+ // note: here, we're reading (data::read)!
+ data::read to_write(m_to_write);
+ for ( f_array::const_iterator b_f = to_write->formats.begin(), e_f = to_write->formats.end(); b_f != e_f; ++b_f)
+ m.format(*b_f);
+
+ for ( d_array::const_iterator b_d = to_write->destinations.begin(), e_d = to_write->destinations.end(); b_d != e_d; ++b_d)
+ m.write(*b_d);
+ }
+
+ private:
+ data m_to_write;
+ };
+
+
+ /**
+ @brief. Represents a router - by default, first calls all formatters, then all destinations. However you can overwrite this route
+
+ You can append a route - with append_route(), or set the route with set_route().
+
+ Example:
+
+ @code
+ typedef process_msg< gather::ostream_like::return_cache_str<> ,
+ writer::format_write< format_base, destination_base, format_and_write::simple<cache_string>,
+ msg_route::with_route<format_base,destination_base> > > process;
+ logger<process, filter::no_ts> g_l;
+
+ g_l->writer().router().set_route()
+ .fmt( write_time() )
+ .fmt( append_enter() )
+ .dest( write_to_dbg() )
+ .fmt( write_idx() )
+ .dest( write_to_cout() )
+ .clear()
+ .fmt( write_idx() )
+ .fmt( append_enter() )
+ .fmt( write_to_file())
+ ;
+ @endcode
+
+ @param format_base The base class for all formatter classes from your application. See manipulator.
+
+ @param destination_base The base class for all destination classes from your application. See manipulator.
+
+ @remarks In the router - we don't own the objects - the array holder does that
+ */
+ template<
+ class formatter_base,
+ class destination_base,
+ class formatter_array = boost::logging::array::shared_ptr_holder<formatter_base>,
+ class destination_array = boost::logging::array::shared_ptr_holder<destination_base>
+ >
+ class with_route : protected formatter_and_destination_array_holder<formatter_array, destination_array> {
+ typedef typename formatter_base::ptr_type formatter_ptr;
+ typedef typename destination_base::ptr_type destination_ptr;
+
+ typedef formatter_and_destination_array_holder<formatter_array, destination_array> holder_base_type;
+
+ typedef with_route<formatter_base, destination_base, formatter_array, destination_array> self_type;
+
+ typedef std::vector<formatter_ptr> f_array;
+ typedef std::vector<destination_ptr> d_array;
+
+ struct write_once {
+ write_once() : do_clear_afterwards(false) {}
+ f_array formats;
+ d_array destinations;
+ // if true, will execute clear_format() after calling all of the above
+ bool do_clear_afterwards;
+ };
+ typedef std::vector<write_once> write_array;
+ typedef typename boost::logging::types<override>::lock_resource::finder<write_array>::type data;
+
+ public:
+ with_route(const formatter_array& formatters, const destination_array & destinations) : holder_base_type(formatters, destinations) {}
+
+ class route;
+ friend class route;
+ /**
+ represents a formatter/destination route to be added/set.
+ */
+ class route {
+ friend class self_type;
+ typedef enum type {
+ is_fmt, is_dest, is_clear
+ };
+ struct item {
+ item() : m_type(is_clear) {}
+ item& fmt(formatter_ptr f) { m_fmt = f; m_type = is_fmt; return *this; }
+ item &dest(destination_ptr d) { m_dest = d; m_type = is_dest; return *this; }
+ formatter_ptr m_fmt;
+ destination_ptr m_dest;
+ type m_type;
+ };
+ typedef std::vector<item> array;
+
+ protected:
+ route(self_type & self) : m_self(self) {}
+ public:
+
+ template<class formatter> route & fmt(formatter f) {
+ m_items.push_back( item().fmt( m_self.formats().get_ptr(f) )) ;
+ return *this;
+ }
+ template<class destination> route & dest(destination d) {
+ m_items.push_back( item().dest( m_self.destinations().get_ptr(d) ));
+ return *this;
+ }
+ route & clear() {
+ m_items.push_back( item() );
+ return *this;
+ }
+
+ protected:
+ self_type & m_self;
+ array m_items;
+ };
+
+ struct route_do_set;
+ friend struct route_do_set;
+ struct route_do_set : route {
+ route_do_set(self_type &self) : route(self) {}
+ ~route_do_set() {
+ m_self.do_set_route( *this);
+ }
+ };
+
+ struct route_do_append;
+ friend struct route_do_append;
+ struct route_do_append : route {
+ route_do_append(self_type &self) : route(self) {}
+ ~route_do_append() {
+ m_self.do_append_route( *this);
+ }
+ };
+
+ /**
+ sets this as the route for logging
+ */
+ route_do_set set_route() { return route_do_set(*this); }
+
+ /**
+ appends this route
+ */
+ route_do_append append_route() { return route_do_append(*this); }
+
+ void append_formatter(formatter_ptr fmt) {
+ data::write to_write(m_to_write);
+
+ if ( to_write->empty() )
+ to_write->push_back( write_once() );
+
+ // we need to add it a the end; if there are any destinations,
+ // we need to add it after those
+ bool can_append_to_back = to_write->back().destinations.empty();
+ if ( !can_append_to_back)
+ to_write->push_back( write_once() );
+ to_write->back().formats.push_back(fmt);
+ }
+ void del_formatter(formatter_ptr fmt) {
+ data::write to_write(m_to_write);
+
+ for ( write_array::const_iterator b = to_write->begin(), e = to_write->end(); b != e; ++b) {
+ f_array::iterator del = std::remove( b->formats.begin(), b->formats.end(), fmt);
+ b->formats.erase(del, b->formats.end());
+ }
+ }
+
+ void append_destination(destination_ptr dest) {
+ data::write to_write(m_to_write);
+
+ if ( to_write->empty() )
+ to_write->push_back( write_once() );
+
+ if ( to_write->back().do_clear_afterwards)
+ // after clear, always start a new write
+ to_write->push_back( write_once() );
+
+ to_write->back().destinations.push_back(dest);
+ }
+
+ void del_destination(destination_ptr dest) {
+ data::write to_write(m_to_write);
+
+ for ( write_array::const_iterator b = to_write->begin(), e = to_write->end(); b != e; ++b) {
+ d_array::iterator del = std::remove( b->destinations.begin(), b->destinations.end(), dest);
+ b->destinations.erase(del, b->destinations.end());
+
+ // if from a write_once - all destinations are gone, don't clear_afterwards
+ if ( b->destinations.empty() )
+ b->do_clear_afterwards = false;
+ }
+ }
+
+ void append_clear_format() {
+ data::write to_write(m_to_write);
+
+ if ( to_write->empty() )
+ to_write->push_back( write_once() );
+ to_write->back().do_clear_afterwards = true;
+ to_write->push_back( write_once() );
+ }
+
+
+ template<class format_and_write, class msg_type> void write(msg_type & msg) const {
+ format_and_write m(msg);
+
+ // note: here, we're reading (data::read)!
+ data::read to_write(m_to_write);
+ for ( write_array::const_iterator b = to_write->begin(), e = to_write->end(); b != e; ++b) {
+ for ( f_array::const_iterator b_f = b->formats.begin(), e_f = b->formats.end(); b_f != e_f; ++b_f)
+ m.format(*b_f);
+
+ for ( d_array::const_iterator b_d = b->destinations.begin(), e_d = b->destinations.end(); b_d != e_d; ++b_d)
+ m.write(*b_d);
+
+ if ( b->do_clear_afterwards)
+ m.clear_format();
+ }
+ }
+
+ private:
+ void do_append_route(const route & r) {
+ if ( r.m_items.empty() )
+ return; // no route to add
+
+ typedef route::array array;
+ for ( array::const_iterator b = r.m_items.begin(), e = r.m_items.end(); b != e; ++b) {
+ switch ( b->m_type) {
+ case route::is_fmt: append_formatter( b->m_fmt); break;
+ case route::is_dest: append_destination( b->m_dest); break;
+ break;
+ case route::is_clear: append_clear_format(); break;
+ break;
+ }
+ }
+ }
+
+ void do_set_route(const route & r) {
+ {
+ data::write to_write(m_to_write);
+ to_write->clear();
+ }
+ do_append_route(r);
+ }
+
+ private:
+ data m_to_write;
+ };
+
+
+ } // namespace msg_route
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // format_write class
+ //
+
+
+ /**
+ @brief Manipulators = Formatters and/or destinations.
+
+ All formatters need to derive from a <b>common %base class</b>. Same goes for destinations.
+
+ Remember:
+ - formatter - allows formatting the message before writing it (like, prepending extra information - an index, the time, thread id, etc)
+ - destination - is a place where the message is to be written to (like, the console, a file, a socket, etc)
+
+ In your @ref boost::logging::writer::format_write "format_write" object, you can have several formatters and destinations. Note that each formatter class and each destination class is a @c %manipulator.
+
+
+
+ When dealing with formatters, the first thing you must do is to specify that common %base class.
+ All formatter classes will derive from it, directly or indirectly. Again, same goes for destinations.
+
+
+ Note that the %formatter %base class and the %destination %base class don't need to be the same. Example:
+
+ @code
+ typedef optimize::cache_string_one_str<> cache_string;
+ typedef formatter::base<cache_string&, op_equal::same_type > format_base;
+
+
+ struct write_time : format_base {
+ void operator()(cache_string & str) const {
+ char t[10];
+ time_t now = time(0);
+ tm details = *localtime(&now);
+ strftime(t, 10, "%M:%S ", &details);
+ str.prepend_string(t);
+ }
+ };
+ //...
+
+ typedef destination::base<const std::string &, op_equal::same_type> destination_base;
+ struct write_to_cout : destination_base {
+ void operator()(param msg) const {
+ std::cout << msg ;
+ }
+ };
+
+ @endcode
+
+ This namespace contains the classes formatter or destination classes need to use as %base class.
+
+
+
+ @section manipulator_base Manipulator base classes
+
+ Your formatter or destination class should derive from either of the following:
+ - base - recommented %base class
+ - base_no_operator_call - %base class , not implementing the operator() call
+
+
+
+
+ @section share_data Sharing data for manipulator classes
+
+ The manipulator classes need to contain data as constant:
+
+ @code
+ struct my_formatter : format_base {
+ ...
+ private:
+ const int m_idx;
+ };
+ @endcode
+
+ As long as data is constant, it's all ok - that is, no matter what functions get called, all the data in the formatter/destination
+ must remain constant. We need constant functors - just like in STL - because internally, we copy formatters/destinations: that is, we keep
+ several copies of a certain object - they all need to be syncronized. In case the objects' data is constant, that's no problem.
+
+ In case the data needs to be changed - it needs to be shared. Several copies of the same instance must point to the same data. In other words,
+ use shared pointers:
+
+ @code
+ struct write_to_file {
+ typedef boost::shared_ptr<std::ofstream> ptr;
+ write_to_file(const std::string & filename) : m_out(new std::ofstream(filename.c_str())) {}
+ void operator()(const std::string & msg) const {
+ (*m_out) << msg << std::endl ;
+ }
+ mutable ptr m_out;
+ };
+ @endcode
+
+ Since quite a few of the manipulator objects will need this, it's quite acceptable to have a class that deals with this:
+ the non_const_context class.
+
+
+ */
+ namespace manipulator {
+
+ namespace detail {
+ struct default_type {};
+ template<class type_> struct ptr_finder {
+ template<class other_type> struct find { typedef other_type type ; };
+ };
+ template<> struct ptr_finder<default_type> {
+ template<class other_type> struct find { typedef other_type* type ; };
+ };
+ }
+
+ /**
+ Formatters and/or destinations are Manipulators.
+
+ All formatter or destination class need to directly or indirectly derive from this.
+
+ All formatters need to derive from a common %base class.
+ When dealing with formatters, the first thing you must do is to specify that common base class.
+ All formatter classes will derive from it, directly or indirectly.
+
+ Same goes for destinations.
+
+ Note that the formatter base class and the destination base class don't need to be the same.
+
+ You should derive your formatter or destination class from this, ONLY if you want to provide
+ your own operator() which could take more than one argument. Otherwise, derive from base.
+
+
+ @section implementing_op_equal_ Implementing operator==
+
+ Formatter objects must be able to be compared. Same goes for destination objects. This is especially
+ needed when a formatter or destination is to be erased - from a @ref boost::logging::writer::format_write "format_write" object.
+
+ There are multiple ways to be able to compare formatter/destination objects - see op_equal namespace.
+
+ By default, @ref boost::logging::op_equal::same_type_op_equal_base is used.
+
+
+
+
+ @param implement_op_equal see @ref implementing_op_equal_
+
+ @param ptr_type_ the type used to hold a pointer to the type. By defaut, it's the type itself.
+
+ */
+ template<
+ class implement_op_equal = op_equal::same_type_op_equal_base,
+ class ptr_type_ = detail::default_type >
+ struct base_no_operator_call : implement_op_equal {
+
+ typedef base_no_operator_call<implement_op_equal, ptr_type_> self_type;
+ typedef typename detail::ptr_finder<ptr_type_> type_finder;
+ typedef typename type_finder::find<self_type>::type ptr_type;
+
+ virtual ~base_no_operator_call() {}
+ };
+
+
+ /**
+ Helper - in case your formatter or destination, in its operator(), it has only one argument
+ (which is most of the time, unless you're doing something extreme ;)), you should derive from this.
+
+
+ Examples:
+ @code
+ // takes a "string&" as argument:
+ struct append_enter : single_param_base<std::string&> {
+ // param - typedef defined in base class; param = std::string&
+ void operator()(param a) {
+ a += "\n";
+ }
+ }
+
+ // takes a "const std::string&" as argument
+ struct write_to_cout : single_param_base<const std::string&> {
+ void operator()(param msg) const {
+ std::cout << msg << std::endl ;
+ }
+ };
+ @endcode
+
+
+ @param implement_op_equal see @ref implementing_op_equal_
+
+ */
+ template<
+ class arg_type,
+ class implement_op_equal = op_equal::same_type_op_equal_base,
+ class ptr_type_ = detail::default_type >
+ struct base : base_no_operator_call<implement_op_equal, ptr_type_> {
+
+ typedef base<arg_type, implement_op_equal, ptr_type_> self_type;
+ typedef typename detail::ptr_finder<ptr_type_> type_finder;
+ typedef typename type_finder::find<self_type>::type ptr_type;
+
+ typedef arg_type param;
+
+ typedef typename boost::remove_const<param>::type non_const_param;
+ // used as msg_type in format_and_write classes
+ typedef typename boost::remove_reference<non_const_param> raw_param;
+
+ virtual ~base() {}
+ virtual void operator()(param val) const = 0;
+ };
+
+ /**
+ In case your manipulator (formatter or destination) needs to hold non-const context information, it can to derive from this.
+ This automatically creates a shared pointer to the context information.
+
+ Also, it provides the following operations:
+
+ @c context(), which returns a <tt>context_type &</tt> reference
+
+ Example:
+
+@code
+struct write_to_file : destination_base, destination::non_const_context<std::ofstream> {
+ write_to_file(const char* filename) : non_const_context_base(filename) {}
+ void operator()(param msg) const {
+ context() << msg ;
+ }
+};
+@endcode
+
+
+ @remarks
+ In case your manipulator has constant data, you don't need this
+ */
+ template<class context_type> struct non_const_context {
+
+ // this can be used in the parent class, to forward data from its constructor
+ typedef non_const_context<context_type> non_const_context_base;
+ private:
+ typedef non_const_context<context_type> self_type;
+ typedef boost::shared_ptr<context_type> ptr_type;
+
+ protected:
+ non_const_context() : m_context(new context_type) {}
+ non_const_context(const non_const_context& other) : m_context(other.m_context) {}
+
+ BOOST_LOGGING_FORWARD_CONSTRUCTOR_WITH_NEW(non_const_context,m_context,context_type)
+
+ context_type & context() const { return *(m_context.get()); }
+
+ private:
+ mutable ptr_type m_context;
+ };
+
+ } // namespace manipulator
+
+ /**
+ @brief Formatter is a manipulator. It allows you to format the message before writing it to the destination(s)
+
+ talk about format_base
+
+ FIXME
+
+ @sa manipulator::base, manipulator::base_no_opearator_call, manipulator::non_const_context
+ */
+ namespace formatter {
+ using boost::logging::manipulator::base;
+ using boost::logging::manipulator::base_no_operator_call;
+ using boost::logging::manipulator::non_const_context;
+ }
+
+ /**
+ @brief Destination is a manipulator. It contains a place where the message, after being formatted, is to be written to.
+
+ Some viable destinations are : the console, a file, a socket, etc.
+
+
+ talk about destination_base
+
+ FIXME
+
+ */
+ namespace destination {
+ using boost::logging::manipulator::base;
+ using boost::logging::manipulator::base_no_operator_call;
+ using boost::logging::manipulator::non_const_context;
+ }
+
+}}
+
+#include <boost/logging/writer/format_write.hpp>
+
+#endif
+

Added: sandbox/logging/boost/logging/format/array.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/format/array.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,92 @@
+// array_holder.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_array_holder_HPP_DEFINED
+#define JT28092007_array_holder_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace boost { namespace logging {
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // array holder class
+ namespace array {
+
+ /**
+ Holds an array of manipulators (formatters or destinations). It owns them, holding them internally as smart pointers
+ Each function call is locked.
+
+ The base_type must implement operator==
+
+ When you call get_ptr() or del(), the type you provide, must implement
+ operator==(const type& , const base_type&)
+ */
+ template <class base_type, class mutex = boost::logging::threading::mutex > class shared_ptr_holder {
+ typedef typename mutex::scoped_lock scoped_lock;
+ public:
+ typedef base_type value_type;
+ typedef boost::shared_ptr<value_type> ptr_type;
+ typedef std::vector<ptr_type> array_type;
+
+ template<class derived> base_type* append(derived val) {
+ // FIXME try/catch
+ derived * copy = new derived(val);
+ scoped_lock lk(m_cs);
+ m_array.push_back( ptr_type(copy));
+ return copy;
+ }
+
+ template<class derived> base_type * get_ptr(derived val) const {
+ scoped_lock lk(m_cs);
+ for ( array_type::const_iterator b = m_array.begin(), e = m_array.end(); b != e; ++b)
+ if ( val == (*(b->get())) )
+ return b->get();
+
+ // not found
+ return 0;
+ }
+
+ template<class derived> void del(derived val) {
+ base_type * p = get_ptr(val);
+ scoped_lock lk(m_cs);
+ for ( array_type::iterator b = m_array.begin(), e = m_array.end(); b != e; ++b)
+ if ( b->get() == p) {
+ m_array.erase(b);
+ return ;
+ }
+ }
+
+
+ private:
+ mutable mutex m_cs;
+ array_type m_array;
+ };
+
+ } // namespace array
+
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/format/op_equal.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/format/op_equal.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,144 @@
+// op_equal.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_op_equal_HPP_DEFINED
+#define JT28092007_op_equal_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <vector>
+
+namespace boost { namespace logging {
+
+/**
+ @brief Different ways to implement operator==
+
+ You need this when:
+ - your logger uses Formatters and Destinations, and
+ - you've added formatters and/or destinations to your logger
+ - at a later time, you want to erase a certain formatter and/or destination from your logger
+
+ If so, we need a way to identify the formatter/destination to be erased.
+*/
+namespace op_equal {
+
+
+
+ /**
+ @brief A unique ID is given to each default-constructed object. If object A is copy-constructed from B, or copy-assigned from B, it will "inherit" its ID.
+
+ A lot of times this is usually enough. Since formatters/destinations either have const context data,
+ or a shared context (@ref boost::logging::manipulator::non_const_context "non_const_context class"), this is enough.
+ */
+ struct unique_id {
+ protected:
+ unique_id() : m_id( next_id() ) {}
+
+ public:
+ bool are_unique_ids_equal(const unique_id & other) const { return m_id == other.m_id; }
+ private:
+ static int next_id() {
+ static threading::mutex cs;
+ static int id = 0;
+ threading::scoped_lock lk(cs);
+ return ++id;
+ }
+
+ int m_id;
+ };
+ inline bool operator==(const unique_id& a, const unique_id & b) { return a.are_unique_ids_equal(b); }
+ namespace detail { namespace {
+ struct make_sure_unique_id_next_id_is_initialized {
+ struct use_unique_id : unique_id {};
+
+ make_sure_unique_id_next_id_is_initialized() {
+ // trick the compiler to make sure the statics in next_id() are initialized before main()!
+ use_unique_id a, b;
+ if ( a == b)
+ std::vector<int> v;
+ }
+ };
+ }}
+
+
+
+ /**
+ @brief Implements operator==, which compares two objects. If they have the same type, it will return true
+
+ For trivial @ref manipulator "manipulators", that don't have any context, this is usually enough.
+
+ If your @ref manipulator "manipulators" have context, you should either use non_const_context class, or same_type_op_equal class.
+ */
+ struct same_type {
+ protected:
+ same_type() {}
+ same_type(const same_type&) {}
+ public:
+ inline bool operator ==(const same_type& other) const { return typeid(*this) == typeid(other); }
+ };
+
+
+
+
+
+ struct same_type_op_equal_top {
+ /*
+ if you get a compile time error here, your formatter or destination needs to derive
+ from same_type_op_equal<your_type>, and implement operator== as a member function , in your class
+ */
+ virtual bool equals(const same_type_op_equal_top &) const = 0;
+ protected:
+ same_type_op_equal_top() {}
+ same_type_op_equal_top(const same_type_op_equal_top&) {}
+ };
+ inline bool operator ==(const same_type_op_equal_top& a, const same_type_op_equal_top&b) { return a.equals(b); }
+
+ /**
+ @brief Base class when you want to implement operator== that will compare based on type and member operator==
+
+ @sa same_type_op_equal
+ */
+ struct same_type_op_equal_base : virtual same_type_op_equal_top {};
+
+
+ /**
+ @brief Implements operator==, which compares two objects. If they have the same type, it will compare them using the type's member operator==.
+
+ The only constraint is that operator== must be a *member* function
+ */
+ template<class type> struct same_type_op_equal : same_type_op_equal_base {
+
+ virtual bool equals(const same_type_op_equal_top & other) const {
+ if ( typeid(*this) != typeid(other))
+ return false;
+ const type & real_other = reinterpret_cast<const type&>(other);
+
+ // this forces 'type' to implement operator==
+ return ((const type&)*this).operator ==( real_other);
+ }
+ };
+
+}}}
+
+#endif
+

Added: sandbox/logging/boost/logging/format/optimize.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/format/optimize.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,198 @@
+// Template.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_TEMPLATE_HPP_DEFINED
+#define JT28092007_TEMPLATE_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <boost/assert.hpp>
+
+namespace boost { namespace logging {
+
+/**
+ @brief Gathering the message: contains optimizers for formatting and/or destinations: for example, caching techniques
+*/
+namespace optimize {
+
+ /**
+ It optimizes the formatting for prepending and/or appending strings to the original message
+
+ It keeps all the modified message in one string. Useful if some formatter needs to access the whole
+ string at once.
+
+ reserve_prepend() - the size that is reserved for prepending (similar to string::reserve function)
+ reserve_append() - the size that is reserved for appending (similar to string::reserve function)
+
+ Note : as strings are prepended, reserve_prepend() shrinks. Same goes for append.
+ */
+ template<class string_type_ = boost::logging::hold_string_type > struct cache_string_one_str {
+ typedef cache_string_one_str<string_type_> self_type;
+ typedef string_type_ string_type;
+
+ /**
+ @param reserve_prepend - how many chars to have space to prepend by default
+ @param reserve_append - how many chars to have space to append by default
+ @param grow_size - in case we add a string and there's no room for it, with how much should we grow? We'll
+ grow this much in addition to the added string - in the needed direction
+ */
+ cache_string_one_str(int reserve_prepend, int reserve_append, int grow_size = 10)
+ : m_reserve_prepend(reserve_prepend), m_reserve_append(reserve_append), m_grow_size(grow_size), m_full_msg_computed(false) {}
+
+ /**
+ @param msg - the message that is originally cached
+ @param reserve_prepend - how many chars to have space to prepend by default
+ @param reserve_append - how many chars to have space to append by default
+ @param grow_size - in case we add a string and there's no room for it, with how much should we grow? We'll
+ grow this much in addition to the added string - in the needed direction
+ */
+ cache_string_one_str(const string_type & msg, int reserve_prepend, int reserve_append, int grow_size = 10)
+ : m_reserve_prepend(reserve_prepend), m_reserve_append(reserve_append), m_grow_size(grow_size), m_full_msg_computed(false) {
+ set_string(msg);
+ }
+
+ void set_string(const string_type & str) {
+ m_str.resize( str.size() + m_reserve_prepend + m_reserve_append);
+ std::copy( str.begin(), str.end(), m_str.begin() + m_reserve_prepend);
+ m_full_msg_computed = false;
+ }
+
+ int reserve_prepend() const { return m_reserve_prepend; }
+ int reserve_append() const { return m_reserve_append; }
+ int grow_size() const { return m_grow_size; }
+
+ void reserve_prepend(int new_size) {
+ resize_string(new_size, m_reserve_append);
+ }
+
+ void reserve_append(int new_size) {
+ resize_string(m_reserve_prepend, new_size);
+ }
+
+ void grow_size(int new_size) {
+ m_grow_size = new_size;
+ }
+
+
+ void prepend_string(const string_type & str) {
+ if ( m_reserve_prepend < (int)str.size()) {
+ int new_reserve_prepend = (int)str.size() + m_grow_size ;
+ resize_string( new_reserve_prepend, m_reserve_append);
+ }
+
+ BOOST_ASSERT(m_reserve_prepend >= (int)str.size() );
+
+ int start_idx = m_reserve_prepend - (int)str.size();
+ m_reserve_prepend -= (int)str.size();
+
+ std::copy(str.begin(), str.end(), m_str.begin() + start_idx);
+ m_full_msg_computed = false;
+ }
+
+ void append_string(const string_type & str) {
+ if ( m_reserve_append < (int)str.size()) {
+ int new_reserve_append = (int)str.size() + m_grow_size ;
+ resize_string( m_reserve_prepend, new_reserve_append);
+ }
+
+ BOOST_ASSERT(m_reserve_append >= (int)str.size() );
+
+ int start_idx = (int)m_str.size() - m_reserve_append;
+
+ std::copy(str.begin(), str.end(), m_str.begin() + start_idx);
+ m_reserve_append -= (int)str.size();
+ m_full_msg_computed = false;
+ }
+
+ /**
+ writes the current cached contents to a stream
+ */
+ template<class stream_type> void to_stream(stream_type & stream) const {
+ stream.write( m_str.begin() + m_reserve_prepend, m_str.size() - m_reserve_prepend - m_reserve_append);
+ }
+
+ /**
+ returns the full string
+ */
+ const string_type & full_string() const {
+ if ( !m_full_msg_computed) {
+ m_full_msg_computed = true;
+ m_full_msg = m_str.substr(m_reserve_prepend, m_str.size() - m_reserve_prepend - m_reserve_append );
+ }
+ return m_full_msg;
+ }
+
+ operator const string_type&() const { return full_string(); }
+
+ private:
+ void resize_string(int reserve_prepend, int reserve_append) {
+ BOOST_ASSERT( reserve_prepend >= 0 && reserve_append >= 0);
+
+ if ( is_string_set() ) {
+ int to_add = reserve_prepend + reserve_append - m_reserve_prepend - m_reserve_append ;
+ int new_size = (int)m_str.size() + to_add;
+ if ( new_size < 0)
+ new_size = 0;
+ // I'm creating a new string instead of resizing the existing one
+ // this is because the new string could be of lower size
+ string_type new_str(reserve_prepend, 0);
+ int used_size = (int)m_str.size() - m_reserve_prepend - m_reserve_append;
+ new_str.insert( new_str.end(), m_str.begin() + m_reserve_prepend, m_str.begin() + m_reserve_prepend + used_size);
+
+ BOOST_ASSERT(new_size == reserve_prepend + used_size + reserve_append);
+
+ new_str.resize( new_size, 0);
+ std::swap(new_str, m_str);
+ }
+
+ m_reserve_prepend = reserve_prepend;
+ m_reserve_append = reserve_append;
+ }
+
+ // if true, string was already set
+ bool is_string_set() const {
+ return (int)m_str.size() > 0;
+ }
+ private:
+ int m_reserve_prepend;
+ int m_reserve_append;
+ int m_grow_size;
+ string_type m_str;
+
+ // caching
+ mutable bool m_full_msg_computed;
+ mutable string_type m_full_msg;
+ };
+
+ /**
+ This gives you 2 extra streams :
+ prepend(), and append()
+ */
+ template<class char_type> struct extra_streams {
+ // FIXME
+ };
+
+}}}
+
+#endif
+

Added: sandbox/logging/boost/logging/level.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/level.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,194 @@
+// level.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// 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>
+
+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:
+
+ info (smallest level),
+ warning ,
+ debug ,
+ 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,
+ info = 1000,
+ warning = 2000,
+ debug = 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, 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".
+ */
+ struct holder_tls_with_cache {
+ typedef locker::tls_resource_with_cache<type> data;
+
+ holder_tls_with_cache(int cache_millis, type default_level = enable_all) : m_level(default_level, cache_millis) {}
+ 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;
+ };
+
+ /**
+ @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;
+ }
+ };
+
+} // 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_tls_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/logging.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/logging.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,38 @@
+// logging.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_logging_HPP_DEFINED
+#define JT28092007_logging_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+#include <boost/logging/filter.hpp>
+#include <boost/logging/process_msg.hpp>
+#include <boost/logging/sink.hpp>
+
+namespace boost { namespace logging {
+
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/macros.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/macros.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,55 @@
+// macros.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_macros_HPP_DEFINED
+#define JT28092007_macros_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+namespace boost { namespace logging {
+
+/**
+ @page macros Macros - how, what for?
+
+ When dealing with logs, you will most likely want to use macros: simply to write less.
+ If order to be efficient, you usually want to write to a log only if it's enabled.
+
+ So, 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()
+
+*/
+
+
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/process_msg.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/process_msg.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,142 @@
+// process_msg.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_process_msg_HPP_DEFINED
+#define JT28092007_process_msg_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>
+
+namespace boost { namespace logging {
+
+
+
+ template<class holder, class gather> struct gather_holder {
+ typedef gather gather_type;
+ gather_holder(const holder & p_this) : m_this(p_this) {}
+ ~gather_holder() {
+ // FIXME handle exiting from exceptions!!!
+
+ m_this.on_do_write(m_obj);
+ }
+ gather_type & gather() { return m_obj; }
+ private:
+ const holder & m_this;
+ mutable gather_type m_obj;
+ };
+
+ namespace detail {
+ template<class type> type& as_non_const(const type & t) { return const_cast<type&>(t); }
+ }
+
+ /**
+ @brief Processes a message (see @ref workflow_processing "workflow")
+
+ As described in @ref workflow_processing "workflow", processing the message is composed of 2 things:
+ - @ref workflow_2a "Gathering the message"
+ - @ref workflow_2b "Processing the message"
+
+ The process_msg class has 2 template parameters:
+
+
+ @param gather_msg A new gather instance is created each time a message is written.
+ The @c gather_msg class needs to be default-constructible.
+ The @c gather_msg must have a function called @c .msg() which contains all information about the written message.
+ It will be passed to the write_msg class.
+ You can implement your own @c gather_msg class, or use any from the gather namespace.
+
+
+ @param write_msg This is the object that does the @ref workflow_2b "second step" - the writing of the message.
+ It can be a simple functor.
+ Or, it can be a more complex object that contains logic of how the message is to be further formatted,
+ and written to multiple destinations.
+ You can implement your own @c write_msg class, or it can be any of the classes defined in writer namespace.
+ Check out writer::format_write - which allows you to use
+ several formatters to further format the message, and then write it to destinations.
+
+
+
+ \n\n
+ The logger forwards all message processing to the @c %process_msg class. The @c %process_msg class forwards
+ the gathering of the message to the @c gather_msg class. Once all message is gathered, it's passed on to the writer.
+ This is usually done through a @ref macros "macro".
+
+ @code
+ logger< process_msg<...> ... > g_log;
+
+ #define L_ if ( !g_log) ; else g_log->read_msg().gather().some_function_in_the_gather_class
+
+ // usage
+ L_ << "cool " << "message";
+
+ @endcode
+
+
+
+ \n\n
+ To understand more on the workflow that involves process_msg:
+ - check out the gather namespace
+ - check out the writer namespace
+
+ */
+ template<class gather_msg, class write_msg> struct process_msg {
+ typedef process_msg<gather_msg, write_msg> self;
+
+ // FIXME we should have a way to specify a template gather_msg - for example useful for cache_string
+
+ process_msg() {}
+ BOOST_LOGGING_FORWARD_CONSTRUCTOR(process_msg,m_writer)
+
+ // FIXME watch for copy-construction!
+ /**
+ reads all data about a log message (gathers all the data about it)
+ FIXME
+ */
+ gather_holder<self, gather_msg> read_msg() const { return gather_holder<self, gather_msg>(*this) ; }
+
+ write_msg & writer() { return m_writer; }
+ const write_msg & writer() const { return m_writer; }
+
+ // called after all data has been gathered
+ void on_do_write(gather_msg & gather) const {
+ m_writer( detail::as_non_const(gather.msg()) );
+ }
+
+ private:
+ write_msg m_writer;
+ };
+
+ template<class arg_type = const char*> struct write_call_func {
+ typedef void (*func)(arg_type) ;
+ write_call_func(func f) : m_f(f) {}
+ void operator()(arg_type a) { f(a); }
+ private:
+ func m_f;
+ };
+
+
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/process_msg/ostream_like.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/process_msg/ostream_like.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,194 @@
+// ostream_like.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_ostream_like_HPP_DEFINED
+#define JT28092007_ostream_like_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+#include <iostream>
+#include <sstream>
+
+namespace boost { namespace logging {
+
+namespace optimize {
+ template<class char_type_ > struct cache_string_one_str ;
+}
+
+/**
+ @brief Classes that implement gathering the message
+
+ A class that implements gathering the message needs 2 things:
+ - a function that will gather the data - give it any name you wish, and call that in your @ref macros "macro"
+ - define a function called <tt>.msg()</tt> that will return the gathered data.
+
+ The gatherer class is used by the process_msg class. When doing %logging, it's usually used like this:
+
+ @code
+ logger< process_msg<some_gather_class, some_writer_class> ... > g_log;
+
+ #define L_ if ( !g_log) ; else g_log->read_msg().gather().gatherer_function...
+
+ // usage
+ L_ << "cool " << "message";
+ @endcode
+
+ Implementing that @c gatherer_function is rather easy, here's a simple example:
+
+ @code
+ struct return_str {
+ typedef std::basic_ostringstream<char_type> stream_type;
+
+ stream_type & out() { return m_out; }
+ std::basic_string<char_type> msg() { return m_out.str(); }
+ private:
+ stream_type m_out;
+ };
+ @endcode
+
+ In the above case, defining the @ref macros "macro" is easy:
+
+ @code
+ #define L_ if ( !g_log) ; else g_log->read_msg().gather().out()
+
+ // usage
+ L_ << "cool " << "message";
+ @endcode
+
+ @sa gather::ostream_like
+*/
+namespace gather {
+
+
+/**
+ @brief Allows you to write to a log using the cool "<<" operator.
+
+ The <tt>.msg()</tt> function returns the gathered message.
+
+ Example:
+ @code
+ struct dump_to_cout {
+ void operator()(const std::stringstream & out) {
+ cout << out.str();
+ }
+ };
+
+ // define the logger
+ typedef process_msg< gather::ostream_like::return_str<>, dump_to_cout> processor;
+ logger<processor, filter::no_ts> g_single_log("out.txt");
+
+ #define L_ if ( g_single_log) ; else g_single_log->read_msg().gather().msg()
+
+ // code
+ i = 100;
+ L_ << "this is " << i << " times better that the average bear... ";
+
+ @endcode
+
+*/
+namespace ostream_like {
+
+/**
+ @brief Allows you to write to a log using the cool "<<" operator. The @c .msg() returns the stream itself.
+
+ @sa ostream_like
+
+ Note that this is a very simple class - meant only as an example.
+ Just remember:
+ 1. you need a function that will gather the data - give it any name you wish, and call that in your macro
+ 2. define a function called msg() that will return the gathered data.
+
+ In our case, 1. and 2. are the same
+*/
+template<class stream_type = std::basic_ostringstream<char_type> > struct return_raw_stream {
+ /**
+ note: we return the whole stream - we don't return out().str() , because the user might use a better ostream class,
+ which could have better access to its buffer/internals
+ */
+ stream_type & msg() { return m_out; }
+private:
+ stream_type m_out;
+};
+
+
+/**
+ @brief Allows you to write to a log using the cool "<<" operator. The .msg() returns a string.
+
+ Note that this is a very simple class.
+
+ Just remember:
+ 1. you need a function that will gather the data - give it any name you wish, and call that in your macro (in this case, it's called "out()")
+ 2. define a function called msg() that will return the gathered data.
+
+ Usage:
+
+ @code
+ struct dump_to_cout {
+ void operator()(const std::string & msg) { cout << msg; }
+ };
+
+ // define the logger
+ typedef process_msg< ostream_like<>, dump_to_cout> processor;
+ logger<processor, filter::no_ts> g_single_log("out.txt");
+
+ #define L_ if ( negate_sink<processor> s = g_single_log) s->read_msg().gather().out()
+
+ // code
+ i = 100;
+ L_ << "this is " << i << " times better that the average bear... ";
+
+ @endcode
+
+
+*/
+template<class stream_type = std::basic_ostringstream<char_type> > struct return_str {
+ stream_type & out() { return m_out; }
+ std::basic_string<char_type> msg() { return m_out.str(); }
+private:
+ stream_type m_out;
+};
+
+
+
+/**
+ @brief Allows you to write to a log using the cool "<<" operator. The .msg() returns a @ref boost::logging::optimize::cache_string_one_str "cache_string".
+
+ @sa ostream_like
+
+ returns a cache string
+*/
+template<class cache_string = boost::logging::optimize::cache_string_one_str<> , int prepend_size = 10, int append_size = 10, class stream_type = std::basic_ostringstream<char_type> > struct return_cache_str {
+ stream_type & out() { return m_out; }
+ cache_string msg() { return cache_string( m_out.str(), prepend_size, append_size ); }
+private:
+ stream_type m_out;
+};
+
+
+
+
+}}}}
+
+#endif
+

Added: sandbox/logging/boost/logging/sink.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/sink.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,86 @@
+// sink.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_sink_HPP_DEFINED
+#define JT28092007_sink_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+namespace boost { namespace logging {
+
+
+
+ /*
+ The sink
+
+ Workflow - we have a sink object, which asks the logger if it's enabled
+ If the logger is enabled, it also returns the message processor.
+
+ Thus, you can write code like this:
+ if ( sink<some_type> s = find_logger(some_logger) )
+ s.process_msg( ... );
+
+ Note that this is useful only if you have a find_logger function which doesn't always return the same logger
+ (thus, you need to cached the result).
+
+ Otherwise, the logger already has helper funcs, which allow you to do this:
+
+ if ( logger) logger.process_msg()....
+ */
+ template<class process_msg_type> struct sink {
+ template<class logger> sink(const logger & f) {
+ p = f.is_enabled() ? &f.process_msg() : 0;
+ }
+ operator bool() const { return p != 0; }
+ const process_msg_type & process_msg() { return *p; }
+ /**
+ Syntactic sugar. Allow writing
+ if ( sink s = dbg_filter) s->some_func(x);
+ */
+ const process_msg_type* operator->() { return p; }
+ protected:
+ const process_msg_type * p;
+ };
+
+ /**
+ This negates the sink, allowing you to create LOG macros. That is, it allows for this construct:
+
+ if ( negate_sink<some_type> s = find_logger(some_filter) )
+ ;
+ else
+ s.process_msg() ...;
+
+ @sa sink
+ */
+ template<class process_msg_type> struct negate_sink : sink<process_msg_type> {
+ typedef typename sink<process_msg_type> base_type;
+ template<class logger> negate_sink(const logger & f) : base_type(f) {}
+ operator bool() const { return p == 0; }
+ };
+
+}}
+
+
+#endif
+

Added: sandbox/logging/boost/logging/ts/ts.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/ts/ts.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,75 @@
+// defs.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT_BOOST_LOG_TS_HPP
+#define JT_BOOST_LOG_TS_HPP
+
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_HAS_THREADS
+
+ #ifdef BOOST_LOG_USE_BOOST_THREADS
+ #include <boost/logging/ts/ts_boost.hpp>
+ #else
+ #ifdef BOOST_WINDOWS
+ #include <boost/logging/ts/ts_win32.hpp>
+ #else
+ #include <boost/logging/ts/ts_posix.hpp>
+ #endif
+ #endif
+
+#else
+ // no threads
+ #include <boost/log/ts/ts_none.hpp>
+#endif
+
+
+
+namespace boost { namespace logging { namespace threading {
+
+#ifdef BOOST_HAS_THREADS
+
+ #ifdef BOOST_LOG_USE_BOOST_THREADS
+ typedef mutex_boost mutex;
+ #else
+ #ifdef BOOST_WINDOWS
+ typedef mutex_win32 mutex;
+ #else
+ typedef mutex_posix mutex;
+ #endif
+ #endif
+
+#else
+ // no threads
+ typedef no_mutex mutex;
+#endif
+
+
+typedef mutex::scoped_lock scoped_lock;
+
+}}}
+
+#endif
+

Added: sandbox/logging/boost/logging/ts/ts_boost.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/ts/ts_boost.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,44 @@
+// defs.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT_BOOST_LOG_TS_BOOST_HPP
+#define JT_BOOST_LOG_TS_BOOST_HPP
+
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/thread/mutex.hpp>
+
+
+namespace boost { namespace logging {
+
+namespace threading {
+
+ typedef boost::mutex mutex_boost;
+ typedef typename mutex::scoped_lock scoped_lock_boost;
+}
+
+}}
+
+
+#endif
+

Added: sandbox/logging/boost/logging/ts/ts_none.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/ts/ts_none.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,53 @@
+// defs.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT_BOOST_LOG_TS_NONE_HPP
+#define JT_BOOST_LOG_TS_NONE_HPP
+
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+
+namespace boost { namespace logging {
+
+namespace threading {
+ // no threads
+ struct no_mutex ;
+
+ struct no_lock {
+ no_lock(no_mutex &) {}
+ };
+
+ struct no_mutex {
+ typedef no_lock scoped_lock;
+ void Lock() {}
+ void Unlock() {}
+ };
+
+
+}
+
+}}
+
+
+#endif
+

Added: sandbox/logging/boost/logging/ts/ts_posix.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/ts/ts_posix.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,122 @@
+// defs.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+// Copyright (C) 2001-2003
+// William E. Kempf
+//
+// Permission to use, copy, modify, distribute and sell this software
+// and its documentation for any purpose is hereby granted without fee,
+// provided that the above copyright notice appear in all copies and
+// that both that copyright notice and this permission notice appear
+// in supporting documentation. William E. Kempf makes no representations
+// about the suitability of this software for any purpose.
+// It is provided "as is" without express or implied warranty.
+
+
+#ifndef JT_BOOST_LOG_TS_POSIX_HPP
+#define JT_BOOST_LOG_TS_POSIX_HPP
+
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdexcept>
+#include <cassert>
+
+namespace boost { namespace logging {
+
+namespace threading {
+
+class scoped_lock_posix ;
+
+class mutex_posix {
+
+ mutex_posix & operator = ( const mutex_posix & Not_Implemented);
+ mutex_posix( const mutex_posix & From);
+public:
+ typedef scoped_lock_posix scoped_lock;
+
+ mutex_posix() : m_mutex() {
+ pthread_mutexattr_t attr;
+ int res = pthread_mutexattr_init(&attr);
+ assert(res == 0);
+
+ res = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ assert(res == 0);
+
+ res = pthread_mutex_init(&m_mutex, &attr);
+ {
+ int res = pthread_mutexattr_destroy(&attr);
+ assert(res == 0);
+ }
+ if (res != 0)
+ throw std::runtime_error("could not create mutex_posix");
+ }
+ ~mutex_posix() {
+ int res = 0;
+ res = pthread_mutex_destroy(&m_mutex);
+ assert(res == 0);
+ }
+
+ void Lock() {
+ int res = 0;
+ res = pthread_mutex_lock(&m_mutex);
+ assert(res == 0);
+ if (++m_count > 1)
+ {
+ res = pthread_mutex_unlock(&m_mutex);
+ assert(res == 0);
+ }
+ }
+ void Unlock() {
+ if (--m_count == 0)
+ {
+ int res = 0;
+ res = pthread_mutex_unlock(&m_mutex);
+ assert(res == 0);
+ }
+ }
+private:
+ pthread_mutex_t m_mutex;
+ unsigned m_count;
+};
+
+class scoped_lock_posix {
+ scoped_lock_posix operator=( scoped_lock_posix & Not_Implemented);
+ scoped_lock_posix( const scoped_lock_posix & Not_Implemented);
+public:
+ scoped_lock_posix( mutex_posix & cs) : m_cs( cs) { m_cs.Lock(); }
+ ~scoped_lock_posix() { m_cs.Unlock(); }
+private:
+ mutex_posix & m_cs;
+};
+
+
+}
+
+}}
+
+
+#endif
+

Added: sandbox/logging/boost/logging/ts/ts_resource.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/ts/ts_resource.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,162 @@
+// ts_object.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_ts_object_HPP_DEFINED
+#define JT28092007_ts_object_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/ts/ts.hpp>
+
+namespace boost { namespace logging {
+
+/**
+ @brief Contains implementations of locker objects. Such a locker can lock data for read or write.
+
+ Assume you have
+ @code
+ struct data {
+ std::string name;
+ std::string desc;
+ };
+
+ some_locker<data> lk;
+ @endcode
+
+
+ In order to access the locked data for write, you do:
+
+ @code
+ some_locker<data>::write obj(lk);
+ obj->name = "coolio";
+ obj->desc = "it works!";
+ @endcode
+
+ In order to access the locked data for read, you do:
+ @code
+ some_locker<data>::read obj(lk);
+ std::cout << obj->name << "/" << obj->desc;
+ @endcode
+
+*/
+namespace locker {
+
+ /**
+ the data to be locked. It's locked using default thread-safety
+
+ @sa locker
+ */
+ template<class type, class mutex = boost::logging::threading::mutex > struct ts_resource {
+ typedef ts_resource<type,mutex> self_type;
+
+ ts_resource(const type& val = type() ) : m_val(val) {}
+
+ struct read;
+ struct write;
+ friend struct read;
+ friend struct write;
+
+ struct write {
+ self_type & self ;
+ write(self_type & self) : self(self) {
+ self.m_cs.Lock();
+ }
+ ~write() {
+ self.m_cs.Unlock();
+ }
+
+ type & use() { return self.m_val ; }
+ type* operator->() { return &use(); }
+ };
+
+ struct read {
+ const self_type & self ;
+ read(const self_type & self) : self(self) {
+ self.m_cs.Lock();
+ }
+ ~read() {
+ self.m_cs.Unlock();
+ }
+
+ const type & use() { return self.m_val ; }
+ const type* operator->() { return &use(); }
+ };
+
+
+ private:
+ mutable mutex m_cs;
+ type m_val;
+ };
+
+ /**
+ Locks a resource, and uses TLS. This holds the value, and each thread caches it.
+ Once at a given period (like, every 5 seconds), when used, the latest object is copied.
+
+ @sa locker
+ */
+ template<class type> struct tls_resource_with_cache {
+ // FIXME - implement using TLS!!!
+
+ typedef tls_resource_with_cache<type> self_type;
+
+ tls_resource_with_cache(const type& val , int cache_millis ) : m_val(val) {}
+
+
+ public:
+ struct read;
+ struct write;
+ friend struct read;
+ friend struct write;
+
+ struct write {
+ self_type & self ;
+ write(self_type & self) : self(self) {
+ }
+ ~write() {
+ }
+
+ type & use() { return self.m_val ; }
+ type* operator->() { return &use(); }
+ };
+
+ struct read {
+ const self_type & self ;
+ read(const self_type & self) : self(self) {
+ }
+ ~read() {
+ }
+
+ const type & use() { return self.m_val ; }
+ const type* operator->() { return &use(); }
+ };
+
+
+
+ private:
+ type m_val;
+ };
+
+
+}}}
+
+#endif
+

Added: sandbox/logging/boost/logging/ts/ts_win32.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/ts/ts_win32.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,77 @@
+// defs.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT_BOOST_LOG_TS_WIN32_HPP
+#define JT_BOOST_LOG_TS_WIN32_HPP
+
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// many thanks to Terris Linerbach!
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+
+
+namespace boost { namespace logging { namespace threading {
+
+class scoped_lock_win32 ;
+
+class mutex_win32 {
+
+ mutex_win32 & operator = ( const mutex_win32 & Not_Implemented);
+ mutex_win32( const mutex_win32 & From);
+public:
+ typedef scoped_lock_win32 scoped_lock;
+
+ mutex_win32() {
+ InitializeCriticalSection( GetCriticalSectionPtr() );
+ }
+ ~mutex_win32() {
+ DeleteCriticalSection(GetCriticalSectionPtr());
+ }
+ void Lock() {
+ EnterCriticalSection( GetCriticalSectionPtr());
+ }
+ void Unlock() {
+ LeaveCriticalSection( GetCriticalSectionPtr());
+ }
+private:
+ LPCRITICAL_SECTION GetCriticalSectionPtr() const { return &m_cs; }
+ mutable CRITICAL_SECTION m_cs;
+};
+
+class scoped_lock_win32 {
+ scoped_lock_win32 operator=( scoped_lock_win32 & Not_Implemented);
+ scoped_lock_win32( const scoped_lock_win32 & Not_Implemented);
+public:
+ scoped_lock_win32( mutex_win32 & cs) : m_cs( cs) { m_cs.Lock(); }
+ ~scoped_lock_win32() { m_cs.Unlock(); }
+private:
+ mutex_win32 & m_cs;
+};
+
+}}}
+
+#endif
+

Added: sandbox/logging/boost/logging/writer/format_write.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/writer/format_write.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,196 @@
+// format_write.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_format_write_HPP_DEFINED
+#define JT28092007_format_write_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/detail/fwd.hpp>
+
+namespace boost { namespace logging {
+
+/**
+@brief Classes that write the message, once it's been @ref gather "gathered".
+
+The most important class is writer::format_write
+
+*/
+namespace writer {
+
+/**
+@brief Allows custom formatting of the message before %logging it, and writing it to several destinations.
+
+Once the message has been @ref boost::logging::gather "gathered", it's time to write it.
+The current class defines the following concepts:
+- formatter - allows formatting the message before writing it
+- destination - is a place where the message is to be written to (like, the console, a file, a socket, etc)
+
+You can add several formatters and destinations. Note that each formatter class and each destination class is a @c %manipulator.
+Make sure you know what a manipulator is before using formatters and destinations.
+
+
+
+\n\n
+@section object_router The router object
+
+Once you've added the formatters and destinations, the @ref msg_route "router" comes into play. The @ref msg_route "router"
+specifies how formatters and destinations are called. By default, all formatters are called first, in the order they were added,
+and then all destinations are called, in the order they were added. You can easily access the router() instance.
+
+@code
+typedef process_msg< gather::ostream_like::return_cache_str<> , format_write<...> > process;
+logger<process, filter::no_ts> g_l;
+#define L_ if ( !g_l) ; else g_l->read_msg().gather().out()
+
+// add formatters : [idx] [time] message [enter]
+g_l->writer().add_formatter( write_idx() );
+g_l->writer().add_formatter( write_time() );
+g_l->writer().add_formatter( append_enter() );
+
+// write to cout and file
+g_l->writer().add_destination( write_to_cout() );
+g_l->writer().add_destination( write_to_file("out.txt") );
+
+// usage
+int i = 1;
+L_ << "testing " << i << i+1 << i+2;
+@endcode
+
+In the above case, @c write_idx() is called, then @c write_time(), then @c append_enter(). Now, the destinations are called:
+@c write_to_cout(), and then @c write_to_file().
+
+Most of the time this is ok, and this is what the @ref msg_route::simple "default router" does. However, there are other routers
+in the msg_route namespace. For instance, take a look at msg_route::with_route class.
+
+
+
+\n\n
+@section apply_format_and_write_object The apply_format_and_write object
+
+Once the formatters and destinations are added, and you know the route, you have an extra object - the format_and_write - which
+contains the logic for calling the formatters and destinations.
+The format_and_write class knows how to call the formatters and destination @c objects. Usually you'll be happy with the
+format_and_write::simple class - which simply calls @c operator() on the formatters , and @c operator() on the destinations.
+Otherwise, take a look at format_and_write namespace.
+
+An object of this type (apply_format_and_write) is created for each new logged message.
+
+
+\n\n
+@note This class is not thread-safe. If you want thread-safety, check out the other writer classes: on_dedicated_thread and ts_write
+
+
+
+\n\n
+@param format_base The base class for all formatter classes from your application. See manipulator.
+
+@param destination_base The base class for all destination classes from your application. See manipulator.
+
+@param apply_format_and_write [optional] The class that knows how to call the formatters and destinations. See @ref apply_format_and_write_object
+
+@param router_type [optional] The class that knows when to call the formatters, and when to call the destinations. See @ref object_router.
+
+
+
+\n\n
+@remarks Normally the router could own the formatters and destination objects. However, then, it would need to own the objects,
+which would mean needing to come up with a smart pointer strategy. This would complicate the router logic.
+Also, iterating over formatters/destinations would be slower, if we were to keep smart pointers within the router itself.
+*/
+template<
+ class formatter_base,
+ class destination_base,
+ class apply_format_and_write = boost::logging::format_and_write::simple<typename destination_base::raw_param>,
+ class router_type = msg_route::simple<formatter_base, destination_base> ,
+ class formatter_array = array::shared_ptr_holder<formatter_base> ,
+ class destination_array = array::shared_ptr_holder<destination_base> >
+struct format_write {
+ typedef typename formatter_base::ptr_type formatter_ptr;
+ typedef typename destination_base::ptr_type destination_ptr;
+
+ format_write() : m_router(m_formatters, m_destinations) {}
+
+ /**
+ adds a formatter
+ */
+ template<class formatter> void add_formatter(formatter fmt) {
+ formatter_ptr p = m_formatters.append(fmt);
+ m_router.append_formatter(p);
+ }
+
+ /**
+ deletes a formatter
+ */
+ template<class formatter> void del_formatter(formatter fmt) {
+ formatter_ptr p = m_formatters.get_ptr(fmt);
+ m_router.del_formatter(p);
+ m_formatters.del(fmt);
+ }
+
+ /**
+ adds a destination
+ */
+ template<class destination> void add_destination(destination dest) {
+ destination_ptr p = m_destinations.append(dest);
+ m_router.append_destination(p);
+ }
+
+ /**
+ deletes a destination
+ */
+ template<class destination> void del_destination(destination dest) {
+ destination_ptr p = m_destinations.get_ptr(dest);
+ m_router.del_destination(p);
+ m_destinations.del(dest);
+ }
+
+ /**
+ returns the object that actually routes the message
+ */
+ router_type& router() { return m_router; }
+
+ /**
+ returns the object that actually routes the message
+ */
+ const router_type& router() const { return m_router; }
+
+ /**
+ does the actual write
+ */
+ template<class msg_type> void operator()(msg_type & msg) const {
+ router().template write<apply_format_and_write>(msg);
+ }
+
+private:
+ formatter_array m_formatters;
+ destination_array m_destinations;
+ router_type m_router;
+};
+
+} // namespace writer
+
+
+}}
+
+#endif
+

Added: sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,173 @@
+// on_dedicated_thread.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_on_dedicated_thread_HPP_DEFINED
+#define JT28092007_on_dedicated_thread_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 <vector>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/xtime.hpp>
+#include <boost/bind.hpp>
+
+namespace boost { namespace logging { namespace writer {
+
+namespace detail {
+ template<class msg_type> struct dedicated_context {
+ dedicated_context() : is_working(true), write_period_ms(100) {}
+
+ bool is_working;
+ int write_period_ms;
+
+ boost::logging::threading::mutex cs;
+
+ // the thread doing the write
+ boost::shared_ptr<boost::thread> writer;
+
+ // ... so that reallocations are fast
+ typedef boost::shared_ptr<msg_type> ptr;
+ typedef std::vector<ptr> array;
+ array msgs;
+ };
+}
+
+/**
+@brief Performs all writes on a dedicated thread - very efficient and <b>thread-safe</b>.
+
+<tt>\#include <boost/logging/writer/on_dedidcated_thread.hpp> </tt>
+
+Keeps locks in the worker threads to a minimum:
+whenever a message is logged, is put into a queue (this is how long the lock lasts).
+Then, a dedicated thread reads the queue, and processes it one by one.
+
+To transform a writer into on-dedicated-thread thread-safe writer, simply surround the writer with on_dedicated_thread:
+
+Example:
+
+@code
+typedef gather::ostream_like::return_str<> string;
+
+// not thread-safe
+process_msg< string, write_to_cout> g_l;
+
+// thread-safe, on dedicated thread
+process_msg< string, on_dedicated_thread<string,write_to_cout> > g_l;
+
+
+// not thread-safe
+process_msg<
+ string ,
+ format_write<
+ format_base,
+ destination_base, format_and_write::simple<string> > > g_l;
+
+// thread-safe, on dedicated thread
+process_msg<
+ string ,
+ on_dedicated_thread<string, format_write<
+ format_base,
+ destination_base, format_and_write::simple<string> > > > g_l;
+@endcode
+
+*/
+template<class msg_type, class base_type>
+struct on_dedicated_thread
+ : base_type,
+ boost::logging::manipulator::non_const_context<detail::dedicated_context<msg_type> > {
+
+ typedef on_dedicated_thread<msg_type,base_type> self_type;
+ typedef detail::dedicated_context<msg_type> context_type;
+
+ typedef boost::logging::threading::mutex::scoped_lock scoped_lock;
+
+ on_dedicated_thread() {}
+ BOOST_LOGGING_FORWARD_CONSTRUCTOR(on_dedicated_thread,base_type)
+
+ void write_period(int period_ms) {
+ scoped_lock lk( context().cs);
+ context().write_period_ms = period_ms;
+ }
+
+ ~on_dedicated_thread() {
+ boost::shared_ptr<boost::thread> writer;
+ { scoped_lock lk( context().cs);
+ context().is_working = false;
+ writer = context().writer;
+ }
+
+ if ( writer)
+ writer->join();
+ }
+
+ void operator()(const msg_type & msg) {
+ context_type::ptr new_msg(new msg_type(msg));
+
+ typedef boost::shared_ptr<boost::thread> ptr;
+ scoped_lock lk( context().cs);
+ if ( !context().writer)
+ context().writer = ptr( new boost::thread( boost::bind(&self_type::do_write,this) ));
+
+ context().msgs.push_back(new_msg);
+ }
+private:
+ void do_write() {
+ const int NANOSECONDS_PER_SECOND = 1000 * 1000 * 1000;
+
+ int sleep_ms = 0;
+ while ( true) {
+ { scoped_lock lk( context().cs);
+ // refresh it - just in case it got changed...
+ sleep_ms = context().write_period_ms;
+ if ( !context().is_working)
+ break; // we've been destroyed
+ }
+
+ boost::xtime to_wait;
+ xtime_get(&to_wait, boost::TIME_UTC);
+ to_wait.sec += sleep_ms / 1000;
+ to_wait.nsec += (sleep_ms % 1000) * (NANOSECONDS_PER_SECOND / 1000);
+ to_wait.sec += to_wait.nsec / NANOSECONDS_PER_SECOND ;
+ to_wait.nsec %= NANOSECONDS_PER_SECOND ;
+ boost::thread::sleep( to_wait);
+
+ typedef typename context_type::array array;
+ array msgs;
+ { scoped_lock lk( context().cs);
+ std::swap( context().msgs, msgs);
+ // reserve elements - so that we don't get automatically resized often
+ context().msgs.reserve( msgs.size() );
+ }
+
+ for ( typename array::iterator b = msgs.begin(), e = msgs.end(); b != e; ++b)
+ base_type::operator()(*(b->get()));
+ }
+ }
+};
+
+
+}}}
+
+#endif
+

Added: sandbox/logging/boost/logging/writer/ts_write.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/writer/ts_write.hpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,90 @@
+// ts_write.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_ts_write_HPP_DEFINED
+#define JT28092007_ts_write_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>
+
+namespace boost { namespace logging { namespace writer {
+
+ namespace detail {
+ struct ts_write_context {
+ boost::logging::threading::mutex cs;
+ };
+ }
+
+/**
+<tt>\#include <boost/logging/writer/ts_write.hpp> </tt>
+
+Performs all writes in a thread-safe manner.
+In other words, makes sure that all operator() calls of base_type are called in a thread-safe manner.
+
+To transform a writer into thread-safe writer, simply surround the writer with ts_write:
+
+Example:
+
+@code
+// not thread-safe
+process_msg< gather::ostream_like::return_str<>, write_to_cout> g_l;
+
+// thread-safe
+process_msg< gather::ostream_like::return_str<>, ts_write<write_to_cout> > g_l;
+
+
+// not thread-safe
+process_msg<
+ gather::ostream_like::return_cache_str<> ,
+ format_write<
+ format_base,
+ destination_base, format_and_write::simple<cache_string> > > g_l;
+
+// thread-safe
+process_msg<
+ gather::ostream_like::return_cache_str<> ,
+ ts_write< format_write<
+ format_base,
+ destination_base, format_and_write::simple<cache_string> > > > g_l;
+@endcode
+
+Depending on your scenario, you could prefer on_dedicated_thread class.
+
+@sa on_dedicated_thread
+*/
+ template<class base_type> struct ts_write : base_type {
+ BOOST_LOOGING_FORWARD_CONSTRUCTOR(ts_write,base_type)
+
+ template<class msg_type> void operator()(msg_type msg) {
+ typedef boost::logging::threading::mutex::scoped_lock lock;
+ lock lk(context().cs);
+
+ base_type::operator()(msg);
+ }
+ };
+
+}}}
+
+#endif
+

Added: sandbox/logging/generating the docs.txt
==============================================================================
--- (empty file)
+++ sandbox/logging/generating the docs.txt 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,3 @@
+To generate the documentation, go into logging\detail\raw_doc,
+and use the Doxyfile from there.
+

Added: sandbox/logging/lib/logging/doc/html/dummy.txt
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/doc/html/dummy.txt 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,2 @@
+so that this dir exists
+documentation is generated here

Added: sandbox/logging/lib/logging/samples/vc8/loggingvc8/ReadMe.txt
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/vc8/loggingvc8/ReadMe.txt 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,33 @@
+========================================================================
+ CONSOLE APPLICATION : loggingvc8 Project Overview
+========================================================================
+
+AppWizard has created this loggingvc8 application for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your loggingvc8 application.
+
+
+loggingvc8.vcproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+loggingvc8.cpp
+ This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named loggingvc8.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////

Added: sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,12 @@
+// loggingvc8.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+
+#if 0
+int main()
+{
+ return 0;
+}
+
+#endif

Added: sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.sln
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.sln 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loggingvc8", "loggingvc8.vcproj", "{0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ Test|Win32 = Test|Win32
+ TestAll|Win32 = TestAll|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}.Debug|Win32.Build.0 = Debug|Win32
+ {0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}.Release|Win32.ActiveCfg = Release|Win32
+ {0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}.Release|Win32.Build.0 = Release|Win32
+ {0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}.Test|Win32.ActiveCfg = Test|Win32
+ {0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}.Test|Win32.Build.0 = Test|Win32
+ {0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}.TestAll|Win32.ActiveCfg = TestAll|Win32
+ {0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}.TestAll|Win32.Build.0 = TestAll|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal

Added: sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.vcproj
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/vc8/loggingvc8/loggingvc8.vcproj 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,810 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="loggingvc8"
+ ProjectGUID="{0482E04F-64D2-4143-AAD6-96A4A9BBA4EB}"
+ RootNamespace="loggingvc8"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Test|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".,../../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;SINGLE_TEST;_CRT_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="TestAll|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".,../../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="tests"
+ >
+ <File
+ RelativePath="..\..\..\tests\test_dump_to_file_and_cout_ostream_like.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\tests\format\test_format_write_ts.cpp"
+ >
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\tests\format\test_manipulator_being_func.cpp"
+ >
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\tests\format\test_manipulator_with_msg_route.cpp"
+ >
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\tests\test_multiple_levels_to_different_logs.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\tests\test_multiple_levels_to_same_log.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\tests\test_multiple_simple_logs.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\tests\test_simple_dump_to_cout.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\tests\format\test_simple_formatter_simple_apply_format_and_write.cpp"
+ >
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="main"
+ >
+ <File
+ RelativePath=".\loggingvc8.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Test|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="templates"
+ >
+ <File
+ RelativePath="..\template.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Test|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="TestAll|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\template.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="headers"
+ >
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\defaults.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\error.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\filter.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\forward_constructor.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\fwd.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\level.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\logging.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\macros.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\process_msg\ostream_like.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\process_msg.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\sink.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\util.hpp"
+ >
+ </File>
+ <Filter
+ Name="ts"
+ >
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\ts\ts.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\ts\ts_boost.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\ts\ts_none.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\ts\ts_posix.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\ts\ts_resource.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\ts\ts_win32.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="format"
+ >
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\format\array.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\format.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\format\op_equal.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\format\optimize.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="writer"
+ >
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\writer\format_write.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\writer\on_dedicated_thread.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\writer\ts_write.hpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="internal docs"
+ >
+ <File
+ RelativePath="..\..\..\src\changelog.txt"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\internal\desc.txt"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\internal\old todo.txt"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\internal\readme.txt"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="raw_doc"
+ >
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\raw_doc\fixme.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\raw_doc\main.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\raw_doc\namespace_concepts.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\raw_doc\table_of_contents.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\raw_doc\template.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\logging\detail\raw_doc\workflow.hpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/logging/lib/logging/samples/vc8/loggingvc8/stdafx.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/vc8/loggingvc8/stdafx.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// loggingvc8.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file

Added: sandbox/logging/lib/logging/samples/vc8/loggingvc8/stdafx.h
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/vc8/loggingvc8/stdafx.h 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,17 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
+#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#include <stdio.h>
+#include <tchar.h>
+
+
+
+// TODO: reference additional headers your program requires here

Added: sandbox/logging/lib/logging/samples/vc8/template.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/vc8/template.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,30 @@
+// Template.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/template.hpp>
+
+
+namespace boost { namespace logging {
+
+
+
+}}
+// End of file
+

Added: sandbox/logging/lib/logging/src/changelog.txt
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/src/changelog.txt 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,6 @@
+v0.4, 9 oct 2007
+- ts_write and on_dedicated_thread work
+
+v0.5, 11 oct 2007
+- compiles
+- added documentation

Added: sandbox/logging/lib/logging/src/dummy.txt
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/src/dummy.txt 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1 @@
+for now, no source files

Added: sandbox/logging/lib/logging/tests/format/test_format_write_ts.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/format/test_format_write_ts.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,50 @@
+// test_format_write_ts.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format/optimize.hpp>
+#include <boost/logging/process_msg/ostream_like.hpp>
+#include <boost/logging/format.hpp>
+#include <sstream>
+#include <boost/shared_ptr.hpp>
+#include <time.h>
+#include <iostream>
+#include <fstream>
+#include <boost/logging/writer/on_dedicated_thread.hpp>
+
+using namespace boost::logging;
+
+typedef optimize::cache_string_one_str<> cache_string;
+typedef destination::base<const std::string &, op_equal::same_type> destination_base;
+
+
+void test_format_write_ts() {
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_format_write_ts();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/format/test_manip_being_func.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/format/test_manip_being_func.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,42 @@
+// test_manipulator_being_func.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+
+/**
+ Tests formatters and destinations being functions. In this case, calling them won't involve a virtual function call.
+*/
+
+using namespace boost::logging;
+
+
+void test_manipulator_being_func() {
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_manipulator_being_func();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/format/test_manip_w_msgroute.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/format/test_manip_w_msgroute.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,186 @@
+// test_manipulator_with_msg_route.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format/optimize.hpp>
+#include <boost/logging/process_msg/ostream_like.hpp>
+#include <boost/logging/format.hpp>
+#include <sstream>
+#include <boost/shared_ptr.hpp>
+#include <time.h>
+#include <iostream>
+#include <fstream>
+
+
+using namespace boost::logging;
+
+/*
+ Using formatters/destinations.
+
+ Always, in your applications, all formatters need to have a common base class. Same for destinations.
+
+ This calls the formatters/destinations in a specific way - specified by a "route"
+ (class boost::logging::msg_route::with_route)
+
+ The simple router just calls all formatters, and then all destinations.
+ However, with the with_route router, you can specify how they're called.
+
+ In our example:
+
+ to cout: [idx] [time] message [enter]
+ to dbg_window: [time] message [enter]
+ to file: [idx] message [enter]
+
+ So our route is:
+
+ prepend [time]
+ append [enter]
+ to dbg window
+ prepend [idx]
+ to cout
+ clear format
+ prepend [idx]
+ append [enter]
+ to file
+*/
+typedef optimize::cache_string_one_str<> cache_string;
+
+
+//////////////////////////////////////////////////////////////////////
+// Formatters
+
+typedef formatter::base<cache_string&, op_equal::same_type > format_base;
+
+// formatter: prepend the message's index
+struct write_idx : format_base, formatter::non_const_context<int> {
+ write_idx() : non_const_context_base((int)0) {}
+ void operator()(param str) const {
+ std::stringstream idx;
+ idx << "[" << ++context() << "] ";
+ str.prepend_string( idx.str() );
+ }
+};
+
+struct write_time : format_base {
+ void operator()(cache_string & str) const {
+ char t[10];
+ time_t now = time(0);
+ tm details = *localtime(&now);
+ strftime(t, 10, "%M:%S ", &details);
+ str.prepend_string(t);
+ }
+};
+
+struct append_enter : format_base {
+ void operator()(cache_string & str) const {
+ str.append_string("\n");
+ }
+};
+
+//////////////////////////////////////////////////////////////////////
+// Destinations
+
+typedef destination::base<const std::string &, op_equal::same_type> destination_base;
+
+struct write_to_cout : destination_base {
+ void operator()(param msg) const {
+ std::cout << msg ;
+ }
+};
+
+struct write_to_dbg : destination_base {
+ void operator()(param msg) const {
+#ifdef BOOST_WINDOWS
+ ::OutputDebugStringA( msg.c_str() );
+#endif
+ }
+};
+
+struct write_to_file : destination_base, destination::non_const_context<std::ofstream> {
+ write_to_file() : non_const_context_base("out.txt") {}
+ void operator()(param msg) const {
+ context() << msg ;
+ }
+};
+
+typedef process_msg<
+ gather::ostream_like::return_cache_str<> ,
+ writer::format_write<
+ format_base,
+ destination_base,
+ format_and_write::simple_care_for_clear_format<cache_string>,
+ msg_route::with_route<format_base,destination_base> > > process;
+logger<process, filter::no_ts> g_l;
+
+#define L_ if ( !g_l) ; else g_l->read_msg().gather().out()
+
+
+
+void test_manipulator_with_msg_route() {
+ g_l->writer().add_formatter( write_time() );
+ g_l->writer().add_formatter( write_idx() );
+ g_l->writer().add_formatter( append_enter() );
+
+ g_l->writer().add_destination( write_to_cout() );
+ g_l->writer().add_destination( write_to_dbg() );
+ g_l->writer().add_destination( write_to_file() );
+
+ /*
+ prepend [time]
+ append [enter]
+ to dbg window
+ prepend [idx]
+ to cout
+ clear format
+ prepend [idx]
+ append [enter]
+ to file
+ */
+ g_l->writer().router().set_route()
+ .fmt( write_time() )
+ .fmt( append_enter() )
+ .dest( write_to_dbg() )
+ .fmt( write_idx() )
+ .dest( write_to_cout() )
+ .clear()
+ .fmt( write_idx() )
+ .fmt( append_enter() )
+ .fmt( write_to_file())
+ ;
+// DOES NOT work
+
+ int i = 1;
+ L_ << "must be prefixed by index and time , enter is appended as well " << i++;
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_manipulator_with_msg_route();
+
+
+
+
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/format/test_simple_formatter.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/format/test_simple_formatter.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,142 @@
+// test_simple_format_and_write_simple_formatter.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+#include <boost/logging/format/optimize.hpp>
+#include <boost/logging/process_msg/ostream_like.hpp>
+#include <boost/logging/format.hpp>
+#include <sstream>
+#include <boost/shared_ptr.hpp>
+#include <time.h>
+#include <iostream>
+#include <fstream>
+
+using namespace boost::logging;
+
+/*
+ Using simple formatters/destinations.
+ Also, using the simple router: which just calls all formatters, and then all destinations.
+
+ Always, in your applications, all formatters need to have a common base class. Same for destinations.
+
+ Other than that, you can choose your "string" type, and then implement operator().
+
+ Note that here, for formatters, I'm using cache_string - which optimizes formatting the strings.
+
+ Also, I'm adding formatters/destinations, and at a later time, I'm removing some - thus, when logging,
+ we won't call the deleted formatters/destinations.
+*/
+
+typedef optimize::cache_string_one_str<> cache_string;
+
+
+//////////////////////////////////////////////////////////////////////
+// Formatters
+
+typedef formatter::base<cache_string&, op_equal::same_type > format_base;
+
+// formatter: prepend the message's index
+struct write_idx : format_base, formatter::non_const_context<int> {
+ write_idx() : non_const_context_base((int)0) {}
+ void operator()(param str) const {
+ std::stringstream idx;
+ idx << "[" << ++context() << "] ";
+ str.prepend_string( idx.str() );
+ }
+};
+
+struct write_time : format_base {
+ void operator()(cache_string & str) const {
+ char t[10];
+ time_t now = time(0);
+ tm details = *localtime(&now);
+ strftime(t, 10, "%M:%S ", &details);
+ str.prepend_string(t);
+ }
+};
+
+struct append_enter : format_base {
+ void operator()(cache_string & str) const {
+ str.append_string("\n");
+ }
+};
+
+//////////////////////////////////////////////////////////////////////
+// Destinations
+
+typedef destination::base<const std::string &, op_equal::same_type> destination_base;
+
+struct write_to_cout : destination_base {
+ void operator()(param msg) const {
+ std::cout << msg ;
+ }
+};
+
+struct write_to_file : destination_base, destination::non_const_context<std::ofstream> {
+ write_to_file(const char* filename) : non_const_context_base(filename) {}
+ void operator()(param msg) const {
+ context() << msg ;
+ }
+};
+
+typedef process_msg<
+ gather::ostream_like::return_cache_str<> ,
+ writer::format_write<
+ format_base,
+ destination_base, format_and_write::simple<cache_string> > > process;
+logger<process, filter::no_ts> g_l;
+
+#define L_ if ( !g_l) ; else g_l->read_msg().gather().out()
+
+
+void test_simple_format_and_write_simple_formatter() {
+ // add formatters : [idx] [time] message [enter]
+ g_l->writer().add_formatter( write_idx() );
+ g_l->writer().add_formatter( write_time() );
+ g_l->writer().add_formatter( append_enter() );
+
+ // write to cout and file
+ g_l->writer().add_destination( write_to_cout() );
+ g_l->writer().add_destination( write_to_file("out.txt") );
+
+ int i = 1;
+ L_ << "must be prefixed by index and time , enter is appended as well " << i++;
+ L_ << "must be prefixed by index and time , enter is appended as well " << i++;
+ L_ << "must be prefixed by index and time , enter is appended as well " << i++;
+
+ g_l->writer().del_formatter( write_idx() );
+ g_l->writer().del_formatter( append_enter() );
+ g_l->writer().del_destination( write_to_cout() );
+
+ // will not be written to cout
+ L_ << "must be prefixed by time , no enter " << i++;
+ L_ << "must be prefixed by time , no enter " << i++;
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_simple_format_and_write_simple_formatter();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/template.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/template.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,37 @@
+// test_Template.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+
+using namespace boost::logging;
+
+void test_template() {
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_template();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/test_mul_lev_difflogs.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_mul_lev_difflogs.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,122 @@
+// test_multiple_levels_different_logs.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+#include <boost/logging/level.hpp>
+#include <boost/logging/process_msg/ostream_like.hpp>
+#include <boost/shared_ptr.hpp>
+#include <fstream>
+#include <iostream>
+
+using namespace boost::logging;
+
+/*
+ Tests levels - having multiple levels, but all messages go to the same log
+
+ By default we have these levels:
+
+ info (smallest level),
+ warning ,
+ debug ,
+ error ,
+ fatal (highest level)
+
+ Depending which level is enabled, 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.
+
+
+ To see the difference between having multiple levels and logging to the same log destination,
+ or different log destinations, see test_multiple_levels_to_same_log.cpp
+*/
+
+using namespace boost::logging;
+
+struct write_to_file {
+ typedef boost::shared_ptr<std::ofstream> ptr;
+
+ write_to_file(const std::string & filename) : m_out(new std::ofstream(filename.c_str())) {}
+ void operator()(const std::string & msg) const {
+ (*m_out) << msg << std::endl ;
+ }
+
+ // Always, when you need to hold some context in your writer object, you need to hold
+ // it as a shared pointer - this is because multiple copies of the same object might exist at the same time
+ mutable ptr m_out;
+};
+
+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()
+
+void test_multiple_levels_different_logs() {
+ // read from a file, dump it word by word
+ std::ifstream in("readme.txt");
+ std::string word;
+
+ // at this time, print everything
+ level_holder.set_enabled(level::info);
+
+ // when reaching these many words, we toggle the log level (enable/disabling some of the log messages)
+ int toggle_count = 10;
+
+ int idx = 1;
+ int idx_toggle_level = 0;
+ for ( ; in >> word; ++idx) {
+ LAPP_ << "info at : " << idx << " : reading word " << word;
+ LDBG_ << "debug at: " << idx << ", reading " << word;
+ LERR_ << "error at: " << idx << ", while reading " << word;
+
+ if ( idx % toggle_count == 0) {
+ // toggle the logs
+ switch ( ++idx_toggle_level % 4) {
+ case 0: level_holder.set_enabled(level::info); break;
+ case 1: level_holder.set_enabled(level::debug); break;
+ case 2: level_holder.set_enabled(level::error); break;
+ case 3: level_holder.set_enabled(level::fatal); break;
+ }
+ }
+ }
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_multiple_levels_different_logs();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/test_mul_lev_samelog.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_mul_lev_samelog.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,130 @@
+// test_multiple_levels_same_log.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+#include <boost/logging/level.hpp>
+#include <boost/logging/process_msg/ostream_like.hpp>
+#include <boost/shared_ptr.hpp>
+#include <fstream>
+#include <iostream>
+
+/*
+ Tests levels - having multiple levels, but all messages go to the same log
+
+ By default we have these levels:
+
+ info (smallest level),
+ warning ,
+ debug ,
+ error ,
+ fatal (highest level)
+
+ Depending which level is enabled, 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.
+
+
+ To see the difference between having multiple levels and logging to the same log destination,
+ or different log destinations, see test_multiple_levels_to_different_logs.cpp
+*/
+
+using namespace boost::logging;
+
+struct write_to_file {
+ typedef boost::shared_ptr<std::ofstream> ptr;
+
+ write_to_file(const std::string & filename) : m_out(new std::ofstream(filename.c_str())) {}
+ void operator()(const std::string & msg) const {
+ (*m_out) << msg << std::endl ;
+ }
+
+ // Always, when you need to hold some context in your writer object, you need to hold
+ // it as a shared pointer - this is because multiple copies of the same object might exist at the same time
+ mutable ptr m_out;
+};
+
+typedef process_msg< gather::ostream_like::return_str<>, write_to_file> processor;
+
+level::holder_no_ts level_holder;
+/*
+ VERY IMPORTANT: if we plan to write to the same destination, we need to share this:
+ write_to_file writer("out.txt");
+
+ Having 3 separate copies will simply open 3 iostream files on the same file, and that is not
+ guaranteed to work (for instance, the first instance might succeed, while the other 2 would
+ just get 2 invalid streams).
+*/
+write_to_file file_writer("out.txt");
+
+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, file_writer, &level_holder );
+error_logger g_log_err( init_both, file_writer, &level_holder );
+info_logger g_log_app( init_both, file_writer, &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()
+
+
+void test_multiple_levels_same_log() {
+ // read from a file, dump it word by word
+ std::ifstream in("readme.txt");
+ std::string word;
+
+ // at this time, print everything
+ level_holder.set_enabled(level::info);
+
+ // when reaching these many words, we toggle the log level (enable/disabling some of the log messages)
+ int toggle_count = 10;
+
+ int idx = 1;
+ int idx_toggle_level = 0;
+ for ( ; in >> word; ++idx) {
+ LAPP_ << "info at :" << idx << " : reading word " << word;
+ LDBG_ << " debug at : " << idx << ", reading " << word;
+ LERR_ << " error at: " << idx << ", while reading " << word;
+
+ if ( idx % toggle_count == 0) {
+ // toggle the logs
+ switch ( ++idx_toggle_level % 4) {
+ case 0: level_holder.set_enabled(level::info); break;
+ case 1: level_holder.set_enabled(level::debug); break;
+ case 2: level_holder.set_enabled(level::error); break;
+ case 3: level_holder.set_enabled(level::fatal); break;
+ }
+ }
+ }
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_multiple_levels_same_log();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/test_multiple_simple_logs.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_multiple_simple_logs.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,104 @@
+// test_multiple_simple_logs.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+#include <boost/logging/process_msg/ostream_like.hpp>
+#include <boost/shared_ptr.hpp>
+#include <fstream>
+#include <iostream>
+
+using namespace boost::logging;
+
+struct write_to_file {
+ typedef boost::shared_ptr<std::ofstream> ptr;
+
+ write_to_file(const std::string & filename) : m_out(new std::ofstream(filename.c_str())) {}
+ void operator()(const std::string & msg) const {
+ (*m_out) << msg << std::endl ;
+ }
+
+ // Always, when you need to hold some context in your writer object, you need to hold
+ // it as a shared pointer - this is because multiple copies of the same object might exist at the same time
+ mutable ptr m_out;
+};
+
+struct write_to_cout {
+ void operator()(const std::string & msg) const {
+ std::cout << msg << std::endl ;
+ }
+};
+
+struct write_to_dbg {
+ void operator()(const std::string & msg) const {
+#ifdef BOOST_WINDOWS
+ ::OutputDebugStringA( (msg + "\n").c_str() );
+#endif
+ }
+};
+
+typedef process_msg< gather::ostream_like::return_str<>, write_to_cout> processor_cout;
+typedef process_msg< gather::ostream_like::return_str<>, write_to_file> processor_file;
+typedef process_msg< gather::ostream_like::return_str<>, write_to_dbg> processor_dbg;
+
+logger<processor_cout, filter::no_ts> g_log_app;
+logger<processor_file, filter::no_ts> g_log_err("err.txt");
+logger<processor_dbg, filter::no_ts> g_log_dbg;
+
+#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()
+
+
+void test_multiple_simple_logs() {
+ // read from a file, dump it word by word
+ std::ifstream in("readme.txt");
+ std::string word;
+
+ g_log_err.set_enabled(false);
+
+ // when reaching these many words, we toggle the logs (enable/disable them)
+ int toggle_count = 20;
+
+ int idx = 1;
+ for ( ; in >> word; ++idx) {
+ LAPP_ << idx << " : reading word " << word;
+ LERR_ << "error at " << idx << ", while reading " << word;
+ LDBG_ << "debug info: " << idx << ", reading " << word;
+
+
+ if ( idx % toggle_count == 0) {
+ // toggle the logs
+ g_log_app.set_enabled( !g_log_app.is_enabled() );
+ g_log_err.set_enabled( !g_log_err.is_enabled() );
+ g_log_dbg.set_enabled( !g_log_dbg.is_enabled() );
+ }
+ }
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_multiple_simple_logs();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/test_ostream_like.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_ostream_like.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,82 @@
+// test_dump_to_file_and_cout_ostream_like.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+#include <boost/logging/process_msg/ostream_like.hpp>
+#include <fstream>
+#include <iostream>
+#include <boost/shared_ptr.hpp>
+
+using namespace boost::logging;
+
+/*
+ Dump to both cout and file, using the cool "<<" operator.
+
+ Note that writing to the log is totally decoupled from the logging syntax ,
+ while being efficient (if the log is disabled, we don't compute anything related to the message).
+*/
+
+struct write_to_cout_and_file {
+ typedef boost::shared_ptr<std::ofstream> ptr;
+
+ write_to_cout_and_file(const std::string & filename) : m_out(new std::ofstream(filename.c_str())) {}
+ void operator()(const std::string & msg) const {
+ std::cout << msg << std::endl ;
+ (*m_out) << msg << std::endl ;
+ }
+
+ // Always, when you need to hold some context in your writer object, you need to hold
+ // it as a shared pointer - this is because multiple copies of the same object might exist at the same time
+ mutable ptr m_out;
+};
+
+typedef process_msg< gather::ostream_like::return_str<>, write_to_cout_and_file> processor;
+logger<processor, filter::no_ts> g_single_log("out.txt");
+
+#define L_ if ( !g_single_log) ; else g_single_log->read_msg().gather().out()
+
+
+void test_dump_to_file_and_cout_ostream_like() {
+ // read from a file, dump it word by word
+ std::ifstream in("readme.txt");
+ std::string word;
+
+ // when reaching these many words, we toggle the log (enable/disable it)
+ int toggle_count = 20;
+
+ int idx = 1;
+ for ( ; in >> word; ++idx) {
+ L_ << idx << " : reading word " << word;
+
+ if ( idx % toggle_count == 0)
+ g_single_log.set_enabled( !g_single_log.is_enabled() ); // toggle the log
+ }
+}
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_dump_to_file_and_cout_ostream_like();
+}
+
+#endif
+
+// End of file
+

Added: sandbox/logging/lib/logging/tests/test_simple_dump_to_cout.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_simple_dump_to_cout.cpp 2007-10-11 12:33:42 EDT (Thu, 11 Oct 2007)
@@ -0,0 +1,77 @@
+// simple_dump_to_cout.cpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Permission to copy, use, sell and distribute this software is granted
+// provided this copyright notice appears in all copies.
+// Permission to modify the code and to distribute modified code is granted
+// provided this copyright notice appears in all copies, and a notice
+// that the code was modified is included with the copyright notice.
+//
+// This software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#include <boost/logging/logging.hpp>
+#include <iostream>
+#include <fstream>
+
+/*
+ As simple as it gets: Have a simple non-thread safe logger (filter::no_ts),
+ and if the log is enabled, dump to cout.
+
+ We log full messages, no using any "<<" when doing logging. That is,
+ we do this:
+ L_("my message")
+
+ not:
+ L_ << "my message comes from user " << user << ", with greetings"
+*/
+
+struct write_to_cout {
+ void operator()(const std::string & msg) const {
+ std::cout << msg << std::endl ;
+ }
+};
+
+using namespace boost::logging;
+logger<write_to_cout, filter::no_ts> g_single_log;
+
+// FIXME i need to create a macro for "if ( sink<write_to_cout> s = g_single_log) s.process_msg()"
+#define L_(x) if ( g_single_log) g_single_log.process_msg()(x)
+
+
+void test_simple_dump_to_cout() {
+ // read from a file, dump it word by word
+ std::ifstream in("readme.txt");
+ std::string word;
+
+ // we allow only this many words
+ int allow_word_count = 100;
+
+ int idx = 0;
+ for ( ; in >> word; ++idx)
+ if ( idx < allow_word_count )
+ L_("reading word " + word);
+ else if ( idx == allow_word_count )
+ // disable the log
+ g_single_log.set_enabled(false);
+}
+
+
+#ifdef SINGLE_TEST
+
+int main() {
+ test_simple_dump_to_cout();
+}
+
+#endif
+
+// End of 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