|
Boost-Commit : |
From: john.groups_at_[hidden]
Date: 2008-01-15 14:42:51
Author: jtorjo
Date: 2008-01-15 14:42:50 EST (Tue, 15 Jan 2008)
New Revision: 42796
URL: http://svn.boost.org/trac/boost/changeset/42796
Log:
[logging]
v0.13.16, 15 jan 2008
- added destination::named test
Added:
sandbox/logging/lib/logging/tests/test_named/
sandbox/logging/lib/logging/tests/test_named/test.cpp (contents, props changed)
sandbox/logging/lib/logging/tests/test_named/test.vcproj (contents, props changed)
sandbox/logging/lib/logging/tests/test_named/test_named.sln (contents, props changed)
Text files modified:
sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
Modified: sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp 2008-01-15 14:42:50 EST (Tue, 15 Jan 2008)
@@ -1,7 +1,9 @@
/**
@page page_changelog Changelog
-_at_section changelog_cur_ver Current Version: v0.13.14, 15 jan 2008
+@section changelog_cur_ver Current Version: v0.13.16, 15 jan 2008
+- added destination::named test
+- automatically include writer/ts_write.hpp from format.hpp
- added test_tags test
- added test_named_spacer test
- solved bug if user doesn't use formatters/destinations, but uses cached string classes
Added: sandbox/logging/lib/logging/tests/test_named/test.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_named/test.cpp 2008-01-15 14:42:50 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,244 @@
+/*
+ Tests destination::named
+ - I have 3 stream destinations. I do simple logging (no formatting), and see that the message gets written to the destinations I specified
+*/
+
+#include <boost/logging/format.hpp>
+#include <boost/logging/format/destination/named.hpp>
+
+using namespace boost::logging::scenario::usage;
+typedef use< filter_::change::single_thread, filter_::level::no_levels, logger_::change::single_thread, logger_::favor::single_thread > finder;
+
+using namespace boost::logging;
+
+BOOST_DEFINE_LOG_FILTER(g_log_filter, finder::filter )
+BOOST_DEFINE_LOG(g_l, finder::logger )
+
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() )
+
+
+std::stringstream g_first;
+std::stringstream g_second;
+std::stringstream g_third;
+
+destination::named_t<lock_resource_finder::single_thread> g_n;
+
+// we're constantly writing hello world
+std::string g_msg = "hello world";
+
+void init_logs() {
+ g_l->writer().add_destination( g_n
+ .add( "first", destination::stream(g_first) )
+ .add( "second", destination::stream(g_second) )
+ .add( "third", destination::stream(g_third) ));
+
+ g_l->writer().add_formatter( formatter::append_newline() );
+ g_l->writer().add_destination( destination::cout() );
+ g_l->turn_cache_off();
+}
+
+void test_use_all() {
+ g_n.string("first second third");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "hello world\n");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string("first +second third");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "hello world\n");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string("+first second +third");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "hello world\n");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string("+first +second +third");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "hello world\n");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+}
+
+void test_use_2() {
+ g_n.string("first second -third");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "hello world\n");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string("first second ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "hello world\n");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string("first third -second");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "hello world\n");
+ BOOST_ASSERT( g_second.str() == "");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string("first -third +second");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "hello world\n");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string("+third +second");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" second third ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+}
+
+
+void test_use_1() {
+ g_n.string(" second -third -first ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" second -third ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" second ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string("second");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "hello world\n");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" -second third -first ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" third -first ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" third");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "");
+ BOOST_ASSERT( g_third.str() == "hello world\n");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+}
+
+void test_use_0() {
+ g_n.string(" -second -third -first ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" -second -third ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" -second ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+
+ g_n.string(" ");
+ L_ << g_msg;
+ BOOST_ASSERT( g_first.str() == "");
+ BOOST_ASSERT( g_second.str() == "");
+ BOOST_ASSERT( g_third.str() == "");
+ g_first.str("");
+ g_second.str("");
+ g_third.str("");
+}
+
+int main() {
+ init_logs();
+ test_use_all();
+ test_use_2();
+ test_use_1();
+ test_use_0();
+}
Added: sandbox/logging/lib/logging/tests/test_named/test.vcproj
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_named/test.vcproj 2008-01-15 14:42:50 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="test_named"
+ ProjectGUID="{C5897099-5FA2-4E12-AFFC-2015364347FA}"
+ RootNamespace="test"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <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"
+ 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"
+ AdditionalLibraryDirectories="D:\boosts\boost_1_33_1\bin\boost\libs\thread\build\libboost_thread.lib\vc-8_0\debug\threading-multi"
+ 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="0"
+ 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>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\test.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: sandbox/logging/lib/logging/tests/test_named/test_named.sln
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/tests/test_named/test_named.sln 2008-01-15 14:42:50 EST (Tue, 15 Jan 2008)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{C5897099-5FA2-4E12-AFFC-2015364347FA}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C5897099-5FA2-4E12-AFFC-2015364347FA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C5897099-5FA2-4E12-AFFC-2015364347FA}.Debug|Win32.Build.0 = Debug|Win32
+ {C5897099-5FA2-4E12-AFFC-2015364347FA}.Release|Win32.ActiveCfg = Release|Win32
+ {C5897099-5FA2-4E12-AFFC-2015364347FA}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
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