|
Boost-Commit : |
From: john.groups_at_[hidden]
Date: 2007-11-13 15:09:07
Author: jtorjo
Date: 2007-11-13 15:09:07 EST (Tue, 13 Nov 2007)
New Revision: 41068
URL: http://svn.boost.org/trac/boost/changeset/41068
Log:
[logging]
v0.11.11, 13 nov 2007
- solved bug at opening file for initial overwrite
Text files modified:
sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 3 ++-
sandbox/logging/boost/logging/format/destination/file.hpp | 9 +++------
sandbox/logging/lib/logging/tests/do_not_use/testfast.cpp | 6 ++++++
3 files changed, 11 insertions(+), 7 deletions(-)
Modified: sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp 2007-11-13 15:09:07 EST (Tue, 13 Nov 2007)
@@ -1,7 +1,8 @@
/**
@page page_changelog Changelog
-_at_section changelog_cur_ver Current Version: v0.11.10, 12 nov 2007
+@section changelog_cur_ver Current Version: v0.11.11, 13 nov 2007
+- solved bug at opening file for initial overwrite
- added destination::stream and test_log_output
- applied small patch from Jens Seidel - many thanks!
- moved a few files into detail/ directory - to avoid confusion as to what header should be included when
Modified: sandbox/logging/boost/logging/format/destination/file.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/destination/file.hpp (original)
+++ sandbox/logging/boost/logging/format/destination/file.hpp 2007-11-13 15:09:07 EST (Tue, 13 Nov 2007)
@@ -62,13 +62,10 @@
namespace detail {
inline std::ios_base::openmode open_flags(file_settings fs) {
std::ios_base::openmode flags = std::ios_base::out | fs.extra_flags() ;
- if ( fs.do_append() )
+ if ( fs.do_append() && !fs.initial_overwrite() )
flags |= std::ios_base::app;
- // note: on Linux, it opens it RW , and if the file does not exist, nothing happens
-#ifdef BOOST_WINDOWS
- if ( !fs.initial_overwrite() )
- flags |= std::ios_base::in;
-#endif
+ if ( fs.initial_overwrite() )
+ flags |= std::ios_base::trunc;
return flags;
}
Modified: sandbox/logging/lib/logging/tests/do_not_use/testfast.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/do_not_use/testfast.cpp (original)
+++ sandbox/logging/lib/logging/tests/do_not_use/testfast.cpp 2007-11-13 15:09:07 EST (Tue, 13 Nov 2007)
@@ -135,6 +135,11 @@
}
void your_scenario_example() {
+ std::ofstream file;
+ file.open("blah.txt", std::ios::trunc);
+ file << "blabla" ;
+ file.close();
+
// Step 7: add formatters and destinations
// That is, how the message is to be formatted and where should it be written to
@@ -147,6 +152,7 @@
// App log
g_log_app->writer().add_formatter( formatter::time("$hh:$mm.$ss ") );
g_log_app->writer().add_formatter( formatter::append_newline() );
+// g_log_app->writer().add_destination( destination::file("out.txt", destination::file_settings().initial_overwrite(true) ) );
g_log_app->writer().add_destination( destination::file("out.txt") );
g_log_app->writer().add_destination( destination::cout() );
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