|
Boost-Commit : |
From: john.groups_at_[hidden]
Date: 2008-01-24 05:59:16
Author: jtorjo
Date: 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
New Revision: 42949
URL: http://svn.boost.org/trac/boost/changeset/42949
Log:
[logging]
v0.21.3, 24 jan 2008
- added more docs to named_logger
Added:
sandbox/logging/lib/logging/samples/starter/my_app_log.cpp
- copied, changed from r42885, /sandbox/logging/lib/logging/samples/starter/log.cpp
sandbox/logging/lib/logging/samples/starter/my_app_log.h
- copied, changed from r42885, /sandbox/logging/lib/logging/samples/starter/log.h
Removed:
sandbox/logging/lib/logging/samples/starter/log.cpp
sandbox/logging/lib/logging/samples/starter/log.h
Text files modified:
sandbox/logging/boost/logging/detail/raw_doc/breaking_changes.hpp | 4 +-
sandbox/logging/boost/logging/detail/raw_doc/caching.hpp | 6 ++--
sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 3 +
sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp | 46 +++++++++++++++++++++++++-------
sandbox/logging/boost/logging/detail/raw_doc/main.hpp | 9 +++--
sandbox/logging/boost/logging/detail/raw_doc/scenarios.hpp | 6 ++--
sandbox/logging/boost/logging/detail/raw_doc/starter_project.hpp | 14 ++++----
sandbox/logging/boost/logging/detail/raw_doc/todo.hpp | 10 ++----
sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp | 2
sandbox/logging/boost/logging/format/destination/file.hpp | 2
sandbox/logging/boost/logging/format/destination/rolling_file.hpp | 2
sandbox/logging/boost/logging/format_fwd.hpp | 1
sandbox/logging/boost/logging/writer/named.hpp | 57 +++++++++++++++++++++++++++++++++++++--
sandbox/logging/lib/logging/samples/basic_usage/main.cpp | 4 +-
sandbox/logging/lib/logging/samples/scenarios/cache_before_init.cpp | 6 ++--
sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp | 2
sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp | 2
sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp | 4 +-
sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp | 4 +-
sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp | 6 ++--
sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp | 2
sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp | 3 --
sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp | 2
sandbox/logging/lib/logging/samples/scenarios/use_profiler.cpp | 2
sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp | 2
sandbox/logging/lib/logging/samples/scenarios/using_tags.cpp | 2
sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp | 6 ++--
sandbox/logging/lib/logging/samples/starter/my_app_log.cpp | 2
sandbox/logging/lib/logging/samples/starter/my_app_log.h | 19 +++++-------
sandbox/logging/lib/logging/tests/test_after_destroyed/test.cpp | 2
30 files changed, 152 insertions(+), 80 deletions(-)
Modified: sandbox/logging/boost/logging/detail/raw_doc/breaking_changes.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/breaking_changes.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/breaking_changes.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -26,7 +26,7 @@
g_l->writer().add_formatter( formatter::idx(), "[%] " );
g_l->writer().add_formatter( formatter::append_newline_if_needed() );
g_l->writer().add_destination( destination::file("out.txt") );
-g_l->turn_cache_off();
+g_l->mark_as_initialized();
g_log_filter->set_enabled(false);
@@ -40,7 +40,7 @@
g_l()->writer().add_formatter( formatter::idx(), "[%] " );
g_l()->writer().add_formatter( formatter::append_newline_if_needed() );
g_l()->writer().add_destination( destination::file("out.txt") );
-g_l()->turn_cache_off();
+g_l()->mark_as_initialized();
g_log_filter()->set_enabled(false);
Modified: sandbox/logging/boost/logging/detail/raw_doc/caching.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/caching.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/caching.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -66,7 +66,7 @@
L_ << "this message will not be logged";
g_log_filter()->set_enabled(false);
-g_l()->turn_cache_off();
+g_l()->mark_as_initialized();
@endcode
@@ -84,7 +84,7 @@
L_ << "this message will be logged, even if filter will be turned off";
g_log_filter()->set_enabled(false);
-g_l()->turn_cache_off();
+g_l()->mark_as_initialized();
@endcode
@@ -101,7 +101,7 @@
...
L_ << "this message will NOT be logged";
-g_l()->turn_cache_off();
+g_l()->mark_as_initialized();
@endcode
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-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -1,7 +1,8 @@
/**
@page page_changelog Changelog
-_at_section changelog_cur_ver Current Version: v0.21.2, 24 jan 2008
+@section changelog_cur_ver Current Version: v0.21.3, 24 jan 2008
+- added more docs to named_logger
- added named_logger - much easier to use the logging lib - doesn't require any advanced knowledge at all
- simplified examples, removed some of them from the "Scenarios" page; they're still found in the "Examples" section in the docs
- should only fix bugs & update docs until review
Modified: sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/headers_to_include.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -3,28 +3,45 @@
/**
@page headers_to_include Headers to #include
+- @ref headers_to_include_declare
+- @ref headers_to_include_define
+- @ref headers_to_include_example
-- when using the Named Writer (an easy interface to Formatters and Destinations)
+\n
+@section headers_to_include_declare When declaring the logs
+
+- when using Formatters and Destinations, or the Named Writer (an easy interface to Formatters and Destinations)
@code
-// when declaring logs
#include <boost/logging/format_fwd.hpp>
+@endcode
+
+- when using Logging, without Formatters/Destinations
+
+@code
+#include <boost/logging/logging.hpp>
+@endcode
+
+
+
+\n\n
+@section headers_to_include_define When defining the logs
-// when defining logs
+
+- when using the Named Writer (an easy interface to Formatters and Destinations)
+
+@code
#include <boost/logging/format/named_writer.hpp>
- @endcode
+@endcode
- when using Formatters and Destinations
@code
-// when declaring logs
-#include <boost/logging/format_fwd.hpp>
-
-// when defining logs and you don't use thread-safety
+// when defining logs and you don't log messages on a dedicated thread
#include <boost/logging/format.hpp>
-// when defining logs and you use thread-safety
+// when defining logs and you log messages on a dedicated thread (see writer::on_dedicated_thread class)
#include <boost/logging/format_ts.hpp>
@endcode
@@ -32,7 +49,7 @@
- when using tags
@code
-#include <boost/logging/tags.hpp>
+#include <boost/logging/formatter/tags.hpp>
@endcode
@@ -44,6 +61,15 @@
+
+\n\n
+@section headers_to_include_example An Example - the starter project
+
+Note that usually you'll have a header file of your own, where you declare the logs. And a source file where you define and initialize your logs.
+You can take a look at the @ref starter_project "starter project".
+
+
+
*/
}}
Modified: sandbox/logging/boost/logging/detail/raw_doc/main.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/main.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/main.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -15,13 +15,14 @@
The great thing about logging is that you can use it on systems in production and/or in use - if an error occurs,
by examining the log, you can get a picture of where the problem is.
-Good logging is mandatory in support projects, you simply cant live without it.
+Good logging is mandatory in support projects, you simply can't live without it.
Used properly, logging is a very powerful tool. Besides aiding debugging/ testing, it can also show you
how your application is used (which modules, etc.), how time-consuming certain parts of your program are,
-how much bandwidth you application consumes, etc. - it's up to you how much information you log, and where.
+how much bandwidth your application consumes, etc. - it's up to you how much information you log, and where.
+
+<b>Features</b>
-The Boost Log Library has these features:
- A simple and clear separation of @ref namespace_concepts "concepts"
- concepts are also easily separated into namespaces
- A very flexible interface
@@ -47,7 +48,7 @@
- @ref formatter::named_spacer
- @ref destination::named
- @ref caching "cache messages before logs are initialized"
-
+- Allows for @ref profile "profiling itself"
\n\n
Modified: sandbox/logging/boost/logging/detail/raw_doc/scenarios.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/scenarios.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/scenarios.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -27,7 +27,7 @@
@copydoc mul_levels_one_logger
-_at_ref scenarios_code_1 "Click to see the code"
+@ref scenarios_code_mom "Click to see the code"
\n\n\n
@@ -36,7 +36,7 @@
@copydoc one_loger_one_filter
-_at_ref scenarios_code_5 "Click to see the code"
+@ref scenarios_code_noo "Click to see the code"
\n\n\n
@@ -45,7 +45,7 @@
@copydoc fastest_no_ostr_like
-_at_ref scenarios_code_6 "Click to see the code"
+@ref scenarios_code_mon "Click to see the code"
\n\n\n
Modified: sandbox/logging/boost/logging/detail/raw_doc/starter_project.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/starter_project.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/starter_project.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -6,21 +6,21 @@
You've probably looked at the @ref common_scenarios "scenarios", at @ref scenario_multiple_files "basic_usage example",
and just in case, here's a something to get you started in your own project(s).
-You need 2 files:
-- @c log.h - where you declare your log(s)
-- @c log.cpp - where you define and initialize your log(s)
+In your project, you will need to create 2 files:
+- <tt><em>my_app_log</em>.h</tt> - where you declare your log(s)
+- <tt><em>my_app_log</em>.cpp</tt> - where you define and initialize your log(s)
Again, this is just a starter project, you can customize it as you wish. Enjoy!
\n\n
-The log.h file
+The <em>my_app_log</em>.h file
-_at_include starter/log.h
+@include starter/my_app_log.h
\n\n
-The log.cpp file
+The <em>my_app_log</em>.cpp file
-_at_include starter/log.cpp
+@include starter/my_app_log.cpp
*/
Modified: sandbox/logging/boost/logging/detail/raw_doc/todo.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/todo.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/todo.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -26,14 +26,12 @@
- @c normal must have helper to call on on_destructed - like, to be able to write to cout,etc
-- @c high based on formatter::named_spacer and destination::named, make it even easier to use
- existing formatters, destinations (like, include them all, by default, with existing names)
- thus, the user of the lib can just write ONE line, which will do:
- specify formatter(s), and destination(s), and automatically turn the cache off.
- i have to figure out how to specify params to send to inner formatters/destinations (like, "file(err.txt)" etc)
-
- @c normal turn_cache_off() -> find better name, like mark_init_complete() (add a function named like this to call turn_cache_off()).
+- @c normal have a logger_with_filter class, to make using the lib easier (this would hold the logger and the filter).
+
+- @c normal writer::named<> need to allow tags by default, here!
+
- @c high scenario::use class - have ::gather and ::write typedefs !!!
this way we can have: named_logger< finder::gather , writer::named<finder::writer> >
Modified: sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/workflow.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -32,7 +32,7 @@
If @c LDBG_ is disabled, everything after "LDBG_" is ignored. Thus, @c some_func_taking_a_lot_of_cpu_time() will not be called.
First of all, we have 2 concepts:
-- logger : a "logical" log - something you write to; it kwnows its destination(s), that is, where to write to
+- logger : a "logical" log - something you write to; it knows its destination(s), that is, where to write to
- filter : this provides a way to say if a logger is enabled or not. Whatever that "way to say a logger is enabled or not" means,
is up to the designer of the filter class.
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 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -114,7 +114,7 @@
*/
void configure(const hold_string_type & str) {
// configure - the file name, for now
- non_const_context_base::context().name = str;
+ non_const_context_base::context().name.assign( str.begin(), str.end() );
non_const_context_base::context().reopen();
}
};
Modified: sandbox/logging/boost/logging/format/destination/rolling_file.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/destination/rolling_file.hpp (original)
+++ sandbox/logging/boost/logging/format/destination/rolling_file.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -198,7 +198,7 @@
*/
void configure(const hold_string_type & str) {
// configure - the file prefix, for now
- non_const_context_base::context().m_name_prefix = str;
+ non_const_context_base::context().m_name_prefix.assign( str.begin(), str.end());
non_const_context_base::context().m_cur_idx = 0;
non_const_context_base::context().restart();
}
Modified: sandbox/logging/boost/logging/format_fwd.hpp
==============================================================================
--- sandbox/logging/boost/logging/format_fwd.hpp (original)
+++ sandbox/logging/boost/logging/format_fwd.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -172,6 +172,7 @@
#include <boost/logging/detail/scenario.hpp>
+#include <boost/logging/tags.hpp>
#endif
Modified: sandbox/logging/boost/logging/writer/named.hpp
==============================================================================
--- sandbox/logging/boost/logging/writer/named.hpp (original)
+++ sandbox/logging/boost/logging/writer/named.hpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -73,14 +73,65 @@
g_l()->writer().destination("cout file(out.txt) debug");
@endcode
-The syntax of the format string:
-The syntax of the destination string:
+@section format_string_syntax The syntax of the format string
+
+- The format string specifies how the message is to be logged
+- Every formatter is escaped using %<em>fmt</em>%
+ - Available formatters:
+ - <tt>"%idx%"</tt> - writes the index of the message (formatter::idx)
+ - <tt>"%time%"</tt> - writes the time (formatter::high_precision_time)
+ - <tt>"%thread_id%"</tt> - writes the thread id (formatter::thread_id)
+ - if you want to write "%", double it, like this: "%%"
+- "|" is used to specify the original message. What is before it, is prepended to the message, what is after, is appended to the message
+- If a formatter is configurable, append "(params)" to it
+ - For now, only "%time%" is configurable. For instance, "%time%($hh:$mm.$ss.$mili)" writes time like "21:14.24.674"
+
+Example:
+@code
+"%time%($hh:$mm.$ss.$mili) [%idx%] |\n"
+@endcode
+
+The output can look like:
+
+@code
+21:03.17.243 [1] this is so cool
+21:03.17.243 [2] first error
+21:03.17.243 [3] hello, world
+@endcode
+
+
+@section dest_string_syntax The syntax of the destinations string
+
+- The syntax of the destination string specifies where the message is to be logged
+ - Every destination is specified by name
+ - Separate destinations by space (' ')
+- Available destinations
+ - <tt>"cout"</tt> - writes to std::cout (destination::cout)
+ - <tt>"debug"</tt> - writes to the debug window: OutputDebugString in Windows, console on Linux (destination::dbg_window)
+ - <tt>"file"</tt> - writes to a file (destination::file)
+ - <tt>"file2"</tt> - writes to a second file (destination::file)
+ - <tt>"rol_file"</tt> - writes to a rolling file (destination::rolling_file)
+ - <tt>"rol_file2"</tt> - writes to a second rolling file (destination::rolling_file)
+- If a destination is configurable, append "(params)" to it
+ - Right now, "file", "file2", "rol_file" and "rol_file2" are configurable
+ - Append "(filename)" to them to specify the file name. Example: "file(out.txt)" will write to the out.txt file
+
+Examples:
+- "file(out.txt) cout" - will write to a file called out.txt and to cout
+- "cout debug" - will write to cout and debug window (see above)
+- "cout file(out.txt) file2(dbg.txt)" - will write to cout, and to 2 files - out.txt and dbg.txt
+- "cout rol_file(r.txt)" - will write to cout and to a @ref destination::rolling_file "rolling_file" called r.txt
+
+@note
+If you want to output to 2 files, don't use "file(one.txt) file(two.txt)". This will just configure "file" twice, ending up with writing only to "two.txt" file.
+Use "file(one.txt) file2(two.txt)" instead!
-FIXME - need to allow tags by default, here!
@param format_write_ the underlying format writer
+
+
*/
template<class format_write_ /* = default_ */ > struct named {
typedef typename use_default< format_write_, format_write< formatter::base<> , destination::base<> > >::type format_write_type;
Modified: sandbox/logging/lib/logging/samples/basic_usage/main.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/basic_usage/main.cpp (original)
+++ sandbox/logging/lib/logging/samples/basic_usage/main.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -12,8 +12,8 @@
@section scenario_multiple_files_program What the program does
-This represents a @b very basic program to count lines of code from a directory and its subdirs.
-It's very basic on purpose, just to show you how to use the Boost Log library v2 in your own projects.
+This represents a small program to count lines of code from a directory and its subdirs.
+It's a simple application, just to show you how to use the Boost Log library v2 in your own projects.
It counts code lines, empty lines, and comment lines.
Again, it's a very simple program, thus:
Modified: sandbox/logging/lib/logging/samples/scenarios/cache_before_init.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/cache_before_init.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/cache_before_init.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -129,9 +129,9 @@
// if you change this, you'll get a different output (more or less verbose)
g_log_level()->set_enabled(level::info);
- g_log_err()->turn_cache_off();
- g_log_app()->turn_cache_off();
- g_log_dbg()->turn_cache_off();
+ g_log_err()->mark_as_initialized();
+ g_log_app()->mark_as_initialized();
+ g_log_dbg()->mark_as_initialized();
}
void cache_before_init_example() {
Modified: sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -122,7 +122,7 @@
g_l()->writer().add_destination( destination::cout() );
g_l()->writer().add_destination( destination::dbg_window() );
g_l()->writer().add_destination( as_xml("out.txt") );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
// Step 8: use it...
int i = 1;
Modified: sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -113,7 +113,7 @@
g_l()->writer().add_formatter( formatter::append_newline() );
g_l()->writer().add_destination( destination::file("out.txt") );
g_l()->writer().add_destination( destination::dbg_window() );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
for ( int i = 0 ; i < 5; ++i)
boost::thread t( &use_log_thread);
Modified: sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/fastest_no_ostr_like.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -67,8 +67,8 @@
#define LERR_ BOOST_LOG_USE_SIMPLE_LOG_IF_FILTER(g_log_err(), g_log_filter()->is_enabled() )
void fastest_no_ostr_like_example() {
- g_log_app()->turn_cache_off();
- g_log_err()->turn_cache_off();
+ g_log_app()->mark_as_initialized();
+ g_log_err()->mark_as_initialized();
// Step 5: use it...
LAPP_("this is so cool\n");
Modified: sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/fastest_use_ostr_like.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -58,8 +58,8 @@
#define LERR_ BOOST_LOG_USE_LOG_IF_FILTER(g_log_err(), g_log_filter()->is_enabled() )
void fastest_use_ostr_like_example() {
- g_log_app()->turn_cache_off();
- g_log_err()->turn_cache_off();
+ g_log_app()->mark_as_initialized();
+ g_log_err()->mark_as_initialized();
// Step 5: use it...
int i = 1;
Modified: sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -108,9 +108,9 @@
g_log_dbg()->writer().add_destination( destination::dbg_window() );
g_log_dbg()->writer().add_destination( destination::cout() );
- g_log_app()->turn_cache_off();
- g_log_err()->turn_cache_off();
- g_log_dbg()->turn_cache_off();
+ g_log_app()->mark_as_initialized();
+ g_log_err()->mark_as_initialized();
+ g_log_dbg()->mark_as_initialized();
// Step 8: use it...
int i = 1;
Modified: sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -106,7 +106,7 @@
.fmt( formatter::append_newline() )
.dest( destination::file("out.txt") );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
// Step 8: use it...
int i = 1;
Modified: sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -33,9 +33,6 @@
#include <boost/logging/format_fwd.hpp>
-// Optimize : use a cache string, to make formatting the message faster
-BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
-
#include <boost/logging/format/named_writer.hpp>
typedef boost::logging::named_logger<>::type logger_type;
Modified: sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -106,7 +106,7 @@
g_l()->writer().add_destination( destination::file("out.txt") );
g_l()->writer().add_destination( destination::cout() );
g_l()->writer().add_destination( destination::dbg_window() );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
for ( int i = 0 ; i < 5; ++i)
boost::thread t( &use_log_thread);
Modified: sandbox/logging/lib/logging/samples/scenarios/use_profiler.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/use_profiler.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/use_profiler.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -102,7 +102,7 @@
g_l()->writer().add_destination( bl::destination::file("out.txt") );
g_l()->writer().add_destination( bl::destination::cout() );
g_l()->writer().add_destination( bl::destination::dbg_window() );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
// where shall the profile results be outputted?
bl::profile::compute::inst().log_results( bl::destination::file("profile.txt") );
Modified: sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/use_tss_ostringstream.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -68,7 +68,7 @@
g_l()->writer().add_formatter( formatter::append_newline_if_needed() );
g_l()->writer().add_destination( destination::cout() );
g_l()->writer().add_destination( destination::dbg_window() );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
// Step 8: use it...
int i = 1;
Modified: sandbox/logging/lib/logging/samples/scenarios/using_tags.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/using_tags.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/using_tags.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -80,7 +80,7 @@
g_l()->writer().add_formatter( formatter::append_newline() );
g_l()->writer().add_destination( destination::cout() );
g_l()->writer().add_destination( destination::file("out.txt") );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
// Step 8: use it...
int i = 1;
Modified: sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp (original)
+++ sandbox/logging/lib/logging/samples/scenarios/your_scenario.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -135,9 +135,9 @@
g_log_dbg()->writer().add_formatter( formatter::append_newline() );
g_log_dbg()->writer().add_destination( destination::dbg_window() );
g_log_dbg()->writer().add_destination( destination::cout() );
- g_log_app()->turn_cache_off();
- g_log_err()->turn_cache_off();
- g_log_dbg()->turn_cache_off();
+ g_log_app()->mark_as_initialized();
+ g_log_err()->mark_as_initialized();
+ g_log_dbg()->mark_as_initialized();
// Step 8: use it...
int i = 1;
Deleted: sandbox/logging/lib/logging/samples/starter/log.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/starter/log.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
+++ (empty file)
@@ -1,29 +0,0 @@
-// log.cpp
-#include "log.h"
-#include <boost/logging/format.hpp>
-#include <boost/logging/writer/ts_write.hpp>
-#include <boost/logging/format/formatter/tags.hpp>
-
-// uncomment if you want to use do logging on a dedicated thread
-// #include <boost/logging/writer/on_dedicated_thread.hpp>
-
-using namespace boost::logging;
-
-// Step 6: Define the filters and loggers you'll use
-BOOST_DEFINE_LOG_FILTER(g_log_filter, finder::filter )
-BOOST_DEFINE_LOG(g_l, finder::logger)
-
-
-void init_logs() {
- // Add formatters and destinations
- // That is, how the message is to be formatted...
- g_l()->writer().add_formatter( formatter::tag::thread_id() );
- g_l()->writer().add_formatter( formatter::tag::time("$hh:$mm.$ss ") );
- g_l()->writer().add_formatter( formatter::idx() );
- g_l()->writer().add_formatter( formatter::append_newline() );
-
- // ... and where should it be written to
- g_l()->writer().add_destination( destination::cout() );
- g_l()->writer().add_destination( destination::dbg_window() );
- g_l()->writer().add_destination( destination::file("out.txt") );
-}
Deleted: sandbox/logging/lib/logging/samples/starter/log.h
==============================================================================
--- sandbox/logging/lib/logging/samples/starter/log.h 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
+++ (empty file)
@@ -1,55 +0,0 @@
-// log.h
-#ifndef LOG_H_header
-#define LOG_H_header
-
-#include <boost/logging/format_fwd.hpp>
-// If you want to use tags...
-#include <boost/logging/tags.hpp>
-
-// Step 1: Specify the class to hold the message
-namespace b_l = boost::logging;
-typedef b_l::tag::holder<
- // string class
- b_l::optimize::cache_string_one_str<>,
- // tags
- b_l::tag::thread_id, b_l::tag::time> log_string_type;
-// note: if you don't use tags, you can simply use a string class:
-// typedef b_l::optimize::cache_string_one_str<> log_string_type;
-BOOST_LOG_FORMAT_MSG( log_string_type )
-
-// if not compiling fast...
-#ifndef BOOST_LOG_COMPILE_FAST
-#include <boost/logging/format.hpp>
-#include <boost/logging/writer/ts_write.hpp>
-
-// If you use tags...
-#include <boost/logging/format/formatter/tags.hpp>
-
-// uncomment if you want to use do logging on a dedicated thread
-// #include <boost/logging/writer/on_dedicated_thread.hpp>
-#endif
-
-
-// Step 3 : Specify your logging class(es)
-using namespace boost::logging::scenario::usage;
-typedef use<
- // how often do you manipulate (change) the filter?
- filter_::change::often<10>,
- // does the filter use levels?
- filter_::level::no_levels,
- // how often do you manipulate (change) the logger?
- logger_::change::often<10>,
- // for the logger: do you favor speed or correctness?
- logger_::favor::correctness> finder;
-
-// Step 4: declare which filters and loggers you'll use
-BOOST_DECLARE_LOG_FILTER(g_l_filter, finder::filter)
-BOOST_DECLARE_LOG(g_l, finder::logger)
-
-// Step 5: define the macros through which you'll log
-#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
-
-// initialize thy logs..
-void init_logs();
-
-#endif
Copied: sandbox/logging/lib/logging/samples/starter/my_app_log.cpp (from r42885, /sandbox/logging/lib/logging/samples/starter/log.cpp)
==============================================================================
--- /sandbox/logging/lib/logging/samples/starter/log.cpp (original)
+++ sandbox/logging/lib/logging/samples/starter/my_app_log.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -1,4 +1,4 @@
-// log.cpp
+// my_app_log.cpp
#include "log.h"
#include <boost/logging/format.hpp>
#include <boost/logging/writer/ts_write.hpp>
Copied: sandbox/logging/lib/logging/samples/starter/my_app_log.h (from r42885, /sandbox/logging/lib/logging/samples/starter/log.h)
==============================================================================
--- /sandbox/logging/lib/logging/samples/starter/log.h (original)
+++ sandbox/logging/lib/logging/samples/starter/my_app_log.h 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -1,30 +1,27 @@
-// log.h
-#ifndef LOG_H_header
-#define LOG_H_header
+// my_app_log.h
+#ifndef my_app_LOG_H_header
+#define my_app_LOG_H_header
#include <boost/logging/format_fwd.hpp>
// If you want to use tags...
#include <boost/logging/tags.hpp>
// Step 1: Specify the class to hold the message
-namespace b_l = boost::logging;
-typedef b_l::tag::holder<
+namespace bl = boost::logging;
+typedef bl::tag::holder<
// string class
- b_l::optimize::cache_string_one_str<>,
+ bl::optimize::cache_string_one_str<>,
// tags
- b_l::tag::thread_id, b_l::tag::time> log_string_type;
+ bl::tag::thread_id, bl::tag::time> log_string_type;
// note: if you don't use tags, you can simply use a string class:
-// typedef b_l::optimize::cache_string_one_str<> log_string_type;
+// typedef bl::optimize::cache_string_one_str<> log_string_type;
BOOST_LOG_FORMAT_MSG( log_string_type )
// if not compiling fast...
#ifndef BOOST_LOG_COMPILE_FAST
#include <boost/logging/format.hpp>
-#include <boost/logging/writer/ts_write.hpp>
-
// If you use tags...
#include <boost/logging/format/formatter/tags.hpp>
-
// uncomment if you want to use do logging on a dedicated thread
// #include <boost/logging/writer/on_dedicated_thread.hpp>
#endif
Modified: sandbox/logging/lib/logging/tests/test_after_destroyed/test.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_after_destroyed/test.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_after_destroyed/test.cpp 2008-01-24 05:59:13 EST (Thu, 24 Jan 2008)
@@ -52,7 +52,7 @@
g_l()->writer().add_formatter( formatter::append_newline() );
g_l()->writer().add_destination( destination::cout() );
g_l()->writer().add_destination( destination::stream(g_stringstream) );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
g_l()->set_after_destroyed( called_after_log_destruction);
L_ << "hello world";
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