...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
General changes:
attribute_name
arguments to record
and
record_view
. The operators
behave the same way as the similar operators of attribute_value_set
(i.e. return an attribute_value
identified by the name).
basic_formatting_ostream
.
( #9389)
depth
named parameter. ( #9123)
std::regex
.
If boost/log/support/std_regex.hpp
is included, one can use std::regex
expressions with string
matching filters.
BOOST_LOG_USE_STD_REGEX
,
BOOST_LOG_USE_BOOST_REGEX
or BOOST_LOG_USE_BOOST_XPRESSIVE
at Boost.Log build time the user can select which regex implementation
will be used by the library internally for the string matching filters
parsed from strings and settings. Note that this selection does not affect
string
matching filters in expressions.
Bug fixes:
dump
manipulator output on AVX2-enabled
CPUs (e.g. Intel Haswell).
get_attribute
method of loggers.
locked_backend()
function implementation of synchronous
and asynchronous sink frontends.
block_on_overflow
strategy was used.
add_value
manipulator produce
garbage attribute values when using with immediate integer constants. (
#9320)
General changes:
BOOST_LOG_WITHOUT_DEFAULT_FACTORIES
.
By defining this macro the user can disable compilation of the default
filter and formatter factories used by settings parsers. This can substantially
reduce binary sizes while still retaining support for settings parsers.
Note that when this macro is defined the user will have to register all attributes in the library.
boost/log/utility/intrusive_ref_counter.hpp
is deprecated and will be removed
in future releases. Its contents have been reworked and moved to Boost.SmartPtr,
as boost/smart_ptr/intrusive_ref_counter.hpp
.
boost/log/utility/explicit_operator_bool.hpp
is deprecated and will be removed
in future releases. Its contents have been moved to Boost.Utility,
as boost/utility/explicit_operator_bool.hpp
.
boost/log/utility/empty_deleter.hpp
is deprecated and will be removed
in future releases. Its contents have been moved to Boost.Utility,
as boost/utility/empty_deleter.hpp
.
Bug fixes:
timer
attribute generating incorrect time readings on Windows on heavy thread
contention when QueryPerformanceCounter
API was used.
Breaking changes:
basic_formatting_ostream
no longer derives from std::basic_ostream
,
but rather reimplements its and its base classes interface closely. This
solves problems with overloading operator<<
for basic_formatting_ostream
and user-defined types. This will break user's code if it relied on the
inheritance from the standard stream types (such as passing basic_formatting_ostream
object as an argument to a function receiving std::basic_ostream
).
Please, use the stream()
member function to access the standard
stream. This change will not break the
code that outputs user-defined types to a basic_formatting_ostream
stream while there are only operator<<
overloads for the standard stream
types - the code will compile and use the standard operator overloads,
as before.
General changes:
BOOST_LOG_USE_COMPILER_TLS
configuration macro is defined.
add_value
manipulator with MSVC.
dump
output manipulator for printing
binary data.
General changes:
BOOST_LOG_NO_COMPILER_TLS
configuration macro has been replaced with BOOST_LOG_USE_COMPILER_TLS
with the opposite meaning. The support for compiler intrinsics for TLS
is now disabled by default.
BOOST_LOG_WITHOUT_DEBUG_OUTPUT
,
BOOST_LOG_WITHOUT_EVENT_LOG
and BOOST_LOG_WITHOUT_SYSLOG
.
BOOST_LOG_NO_SETTINGS_PARSERS_SUPPORT
macro renamed to BOOST_LOG_WITHOUT_SETTINGS_PARSERS
.
The new macros allow to selectively disable support for the corresponding
sink backends.
BOOST_LOG_USE_WINNT6_API
macro. The code compiled without the macro defined will still be able run
on NT5, but when run on NT6 it will be more efficient. With the macro defined
the resulting code will not run on NT5, but will be a little more efficient
on NT6 than without the macro.
record_view
s. Records are now
moved from when pushed to the core for further processing. This is done
in order to eliminate the possibility of unsafe record modification after
pushing to the core. As a consequence, log records can no longer be copied,
only moving is allowed. Record views can be copied and moved; copying is
a shallow operation.
to_log
manipulator allows to customize
formatting for particular types and attributes without changing the regular
streaming operator. Also, the add_value
manipulator can be used
in logging expressions to attach attribute values to the record.
Attributes:
attribute_value
class in various components of the library is no longer pointed to with
shared_ptr
s but instead
is handled by value. This allowed to simplify attribute value handling
in simple cases.
attribute
base class, which holds the reference to the implementation. All attributes
now have to be created by value rather than wrapped into shared_ptr
by user, which makes the code
more concise.
attribute
to the actual attribute type. This can be useful when the concrete attribute
factory provides additional interfaces.
get
method. Use the extract
function as a replacement.
attribute_name
.
It is constructible from strings, so in most cases users won't need to
change the code. See here
for more information.
scoped_attribute.hpp
moved from utility
to the
attributes
directory. The
header attribute_value_extractor.hpp
in utility
has been replaced
with headers boost/log/attributes/value_extraction.hpp
and boost/log/attributes/value_visitation.hpp
in the attributes
directory.
The two new headers define the revised API of attribute value extraction
and visitation, respectively. See here
for more details.
current_thread_id
attribute no longer uses boost::thread::id
type for thread identification. An internal type is used instead, the type
is accessible as current_thread_id::value_type
.
The new thread ids are taken from the underlying OS API and thus more closely
correlate to what may be displayed by debuggers and system diagnostic tools.
current_process_name
attribute.
The attribute generates a string with the executable name of the current
process.
functor
attribute has
been renamed to function
.
The generator function has been renamed from make_functor_attr
to make_function
. The header
has been renamed from functor.hpp
to function.hpp
.
Logging sources:
BOOST_LOG_DECLARE_GLOBAL_LOGGER_INIT
to BOOST_LOG_INLINE_GLOBAL_LOGGER_INIT
,
BOOST_LOG_DECLARE_GLOBAL_LOGGER
to BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT
,
BOOST_LOG_DECLARE_GLOBAL_LOGGER_CTOR_ARGS
to BOOST_LOG_INLINE_GLOBAL_LOGGER_CTOR_ARGS
).
Also, the macros no longer define the get_logger
free function for logger acquisition. Use logger::get
instead. See here
for more information.
BOOST_LOG_STREAM_CHANNEL
and BOOST_LOG_STREAM_CHANNEL_SEV
(as well as their shorthands BOOST_LOG_CHANNEL
and BOOST_LOG_CHANNEL_SEV
)
macros that allow to specify channel name for the log record.
Logging sinks:
_t
suffix.
basic_formatting_sink_backend
class template, which indicates to the frontend that record formatting
is required. This breaks user-side API of the library: the formatter and
locale has to be set to the frontend rather than backend.
void flush()
.
asynchronous_sink
class template now allows to specify record queueing strategy. Several
strategies provided, including unbounded_fifo_queue
(the default) and unbounded_ordering_queue
which cover the functionality of asynchronous sink frontends in 1.x releases.
See the asynchronous
sink frontend docs for more details.
Append
configuration
file parameter for text file sinks. If this parameter is set to true
, the sink will append log records to
the existing log file instead of overwriting it.
Filters and formatters:
filter
and basic_formatter
.
Both new types implement type erasure and provide function calling operators
to invoke the stored filter or formatter.
expressions
namespace. Attribute placeholders are now interoperable with other template
expressions based on Boost.Phoenix.
All template expression headers now reside in the expressions
subdirectory.
BOOST_LOG_ATTRIBUTE_KEYWORD
macro). Keywords
can be used in template expressions instead of attribute placeholders and
also as a key in container lookups.
false
in such cases, the formatter
will result in empty string instead of the value. The behavior can be changed
by calling or_default
or
or_throw
member functions
on the attribute value placeholder in the filtering/formatting expression.
format_date_time
.
format_named_scope
.
c_decor
,
c_ascii_decor
, xml_decor
and csv_decor
.
The generic character decorator is named char_decor
now.
Documentation changes:
Miscellaneous:
push_record
if a sink throws and the
exception is suppressed by the exception handler set in the core.
type_visitor
instance by
value, and the visitor is no longer a base for the actual receiver of the
dispatched value. Instead, the visitor now refers to the receiver, if one
is capable to consume the value. The visit
method has been renamed to operator
()
. The static type dispatcher now
requires a reference to the receiver on construction, it doesn't imply
that the receiver derives from the dispatcher anymore.
slim_string
utility
has been removed. There is no replacement.
This release mostly fixes bugs in the code and documentation.
This release mostly fixes bugs in the code and documentation. The next major release (2.0) will contain breaking changes and feature additions. The 1.0 branch will not receive any feature updates.
BOOST_LOG_NO_COMPILER_TLS
during the library build process. The macro also affects other platforms,
which may be useful if your compiler does not support TLS.
rotation_interval
keyword is no longer
available. The same functionality is achieved with the new time_based_rotation
keyword and the
rotation_at_time_interval
predicate. See here
for more details.
support
directory. Top level library headers now mostly include nested headers.
keywords
namespace. There are no longer nested keywords
namespaces in sinks
, attributes
, etc. All keywords have been
extracted into separate headers in the keywords
directory.
add_common_attributes
.
init_log_to_file
now accept more customization options as named arguments.
No one really remembers these dark ages...