This avoids possible inconsistency when the BOOST_LOG_WITHOUT_DEBUG_OUTPUT
and BOOST_LOG_WITHOUT_EVENT_LOG macros are defined in config.hpp but not
in command line.
Related to https://github.com/boostorg/log/issues/102.
This fixes compilation problems with C++20 std::allocator, which removed
deprecated typedefs and member functions.
Closes https://github.com/boostorg/log/pull/100.
If the log file has not been created (e.g. when there are no log records
written yet), rotate_file could throw as it attempted to rename the file
to the target file name before rotation. The check for file presence that
was intended to protect from this was made later on, before the file collector
is invoked. This commit moves the check before renaming.
Since day_kind is enum, it may be represented by a signed integer type.
Some compilers (e.g. MSVC) use sign extension when loading the day kind
field from the bit field, which corrupts the monthday value (which is 2)
and makes the rotation never happen. Fix this by using an unsigned type
to store the day kind and then cast the value to the enum.
Also, rearranged the bitfields for slightly better codegen.
Fixes https://github.com/boostorg/log/issues/98.
Some syslog implementations (e.g. glibc) do not save the ident string
in openlog and instead only save a pointer to the user-provided string.
This requires the caller to preserve the passed string for the whole
duration of logging.
Fixes https://github.com/boostorg/log/issues/97.
The new example demostrates working with the settings container directly
and provides a more complete view on the library initialization.
Closes https://github.com/boostorg/log/issues/87.
The default filter/formatter factories will now be able to extract severity
level values of type boost::log::trivial::severity_level. For filters, this
is only supported for attributes with the "Severity" name.
This allows to specify directly custom function objects, including C++11
lambda functions, in the filter and format named parameters in the sink
initialization calls.
Closes https://github.com/boostorg/log/issues/63.
The manipulator and formatter can be used to ensure a certain piece of output
ends with a newline without introducing duplicate newline characters if the
previous output ended with a newline already.
Text ostream, file and multifile sink backends now support controlling trailing
newline insertion after every log records. The supported modes are described by
the auto_newline_mode enum. The behavior can be controlled via the same-named
named parameter, a set_auto_newline_mode call or the AutoNewline parameter
in the settings.
The default behavior has changed from the previous releases. From now on the
trailing newline will only be added if there isn't one in the formatted log
message already.
When a user defines an output operator for std::basic_ostream and
a pointer to a user-defined type, that operator use to be ignored
because of the implicit cast to const void* that happened when
operator<< for formatting_ostream or record_ostream was called.
We now forward the pointer type to the operator<< for std::ostream,
so it is either cast then or user's operator<< is picked.
Fixes https://github.com/boostorg/log/issues/84.
Explicit output operators allow to enable character code conversion, if
one is needed, on string view output. This is in line with the existing
support for other string types.
If a file name pattern ended with a placeholder, e.g. a file counter, file names
fitting that pattern would not be matched by scan_for_files, leaving such files
unmanaged.
Fixes https://github.com/boostorg/log/issues/78.
Boost.Parameter added new named parameter wrappers for compatibility with
Boost.MP11. The SFINAE helper used to detect named parameters in Boost.Log
has been updated to work with these new types and potentially any new
types that may come in the future.
Some users mistakenly assumed that enabling compiler TLS intrinsics would
remove the need for Boost.Thread. This added note should remove that confusion.
This commit reworks file_name parameter handling for the file sink setup helper.
Boost.Parameter was modified recently in develop, which made it incompatible
with the previous implementation of the file_name helpers. At the same time,
it has not been merged to master, and the master version is not compatible
with the new implementation.
To resolve this, avoid mentioning the actual type of the tagged argument
constructed from the assignment to the named parameter keyword. This type refers
to Boost.Parameter implementation details namespace, so as a bonus we reduce
the dependency on Boost.Parameter implementation details.
See: https://github.com/boostorg/parameter/issues/65
The compiler is able to optimize away most of the instructions that we test,
which results in checking only the compiler support for intrinsics, and not
the assembler capability to translate SSSE3 and AVX2 instructions from assembler
into the actual binary code. This commit forces the compiler to actually emit
instructions in the assembler, which then tests binutils capability to translate
those into binary code.
Some tests pull in pthread rwlock and therefore need _XOPEN_SOURCE=600
or higher to compile. Added platform defines to tests and examples
for good measure.
For MinGW worked around Boost.Build error when BOOST_LOG_WITHOUT_EVENT_LOG
is defined.