Boost.Log's config.hpp may define BOOST_LOG_WITHOUT_SYSLOG if no native
syslog API or Boost.ASIO is available, so we need to include the header
before checking the macro.
Closes https://github.com/boostorg/log/pull/123.
The stream will be checked in the operator<< of the value anyway, and we don't
save much performance by checking the stream before invoking
optional_manipulator::output.
Logger move constructors don't need to add the attributes to the logger
attributes since the latter are moved from the source logger, just as the
attributes. This allows move constructors to be noexcept, provided that
they are non-noexcept for other reasons.
Closes https://github.com/boostorg/log/issues/121.
The syslog sink backend now verifies the IP version of the local and target
addresses set by user. The addresses must have the same IP version as was
specified in the ip_version named parameter on the sink backend construction.
When an address is obtained as a result of host name resolution, only addresses
with matching IP version are considered.
This should protect against using local and target addresses with mismatching
IP versions, which results in errors on sending datagrams.
Fixes https://github.com/boostorg/log/issues/119.
This makes the code more SFINAE-friendly. It also changes the converting
constructor and assignment operator to only work as converting constructor and
assignment and let the compiler generate the implicit copy constructor and
assignment operator. This should silence bogus clang-10 warnings about
deprecated generation of an implicit copy assignment operator in presence of
a copy constructor. (The warning is bogus because there already is an explicitly
defined assignment operator, which works as a copy assignment as well.)
Closes https://github.com/boostorg/log/issues/118.
Explicit specification of attribute value type is necessary when it cannot
be inferred from the function object type. With C++20 removing argument type
typedefs from standard function objects, like std::less, and compilers following
suit (e.g. future MSVC versions), it is better to update the example so that
it is compatible with future compilers.
Related to https://github.com/boostorg/log/issues/105.
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.