Commit Graph

93 Commits

Author SHA1 Message Date
Andrey Semashev
08bd1fb809 Added support for trivial::severity_level to filter/formatter parsers.
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.
2019-06-25 18:54:55 +03:00
Andrey Semashev
e4f91a2431 Added support for arbitrary functions in filter and format named parameters.
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.
2019-06-24 04:04:09 +03:00
Andrey Semashev
ed5af03352 Corrected a typo. 2019-06-24 00:33:03 +03:00
Andrey Semashev
326d97a9d1 Added auto_newline stream manipulator and formatter.
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.
2019-06-24 00:27:16 +03:00
Andrey Semashev
894acde57e Added support for controling trailing newline insertion in the text sinks.
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.
2019-06-23 21:02:51 +03:00
Andrey Semashev
d66ab73a5f Added forwarding of pointer type in Boost.Log streams.
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.
2019-05-25 21:38:04 +03:00
Andrey Semashev
3925052c30 Added explicit support for std::string_view in formatting_ostream.
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.
2019-05-25 21:27:49 +03:00
Andrey Semashev
d7a87119e6 Fixed incorrect matching of digits in a file name against a placeholder.
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.
2019-04-14 20:14:58 +03:00
Andrey Semashev
e823f88467 Added support for a separate target file name pattern in text file sink.
This allows to have different file names when actively writing the log file
and when rotating. In particular, this solves the problem with appending
to the previous file, when the log files are also collected and are supposed
to have distincs names.
2019-01-05 21:15:33 +03:00
Andrey Semashev
f8954f6662 Work around incorrect total file size estimate in file_collector.
If the text file sink backend used the file that was previously scanned
by file_collector as an old log file, on rotation the collector would
store a duplicate of the file info. If the file was removed due to
storage limits, the file info would still be stored despite the file
being deleted.

Also, in case if a file that is about to be rotated is deleted, don't
hard fail with an exception. This may happen if another process have deleted
the file or Boost.Log itself has. The latter can happen if multiple sinks
write directly into the common target storage and one of them invokes
file rotation, which due to the storage limits delete the file that
is currently being written by the other sink.
2018-10-30 04:29:49 +03:00
Andrey Semashev
a95dc575a1 Updated Boost.ASIO usage to avoid using deprecated APIs.
Fixes https://github.com/boostorg/log/issues/59.
2018-10-21 22:21:10 +03:00
Andrey Semashev
cf8b4a3238 Added a changelog entry about better support for VxWorks. 2018-06-01 14:23:38 +03:00
Andrey Semashev
f66f8923ff Added docs for the Append settings parameter for the TextFile sinks.
The parameter was supported in the code but was not documented.
2018-01-17 13:09:20 +03:00
Andrey Semashev
bf5e26c2e1 Use std::allocator_traits where possible to work with allocators.
This should help avoid using members that were deprecated in C++17 and thus
improve compatibility with later language versions.

The commit also adds a new internal trait rebind_alloc that helps to portably
rebind the allocator to another allocated type. The trait also avoids
instantiation of std::allocator<void> which is also deprecated in C++17.
2018-01-03 19:50:44 +03:00
Andrey Semashev
7f75487d0b Fixed bad file counter returned from scan_for_files in case of counter overflow.
If the target directory contained a file with counter value of UINT_MAX in its
name, scan_for_files would always return the counter value of 0, even if such
file also existed in the directory. This caused incorrectly named log files to
appear in the target directory on user's application restart.

Also made sure that the returned counter value is zero if the scanning method
is not scan_matching or the file name pattern does not include the counter
placeholder. The returned counter should not have been used by the caller
in these cases anyway, but the returned value used to be bogus.
2017-08-15 16:09:50 +03:00
Andrey Semashev
a73ed3ef38 Updated library build scripts to unify system macros configuration for different platforms. In particular, this should improve compatibility with Solaris. It also avoids duplicating system macros in different places. 2017-06-30 23:42:45 +03:00
Andrey Semashev
38fd663541 Added a way to disable log file rotation on sink destruction.
This can be useful when the final rotation cannot be performed while global destructors are run (e.g. when a close handler depends on a global state).

It can also be useful to implement file appending with collector set up to a different target directory than the directory the backend writes to.
2016-11-27 22:53:32 +03:00
Andrey Semashev
299603ff02 Fixed auto-detection of native syslog API.
The auto-detection was removed in 1.62, which resulted in UDP socket-based implementation being always used. The new auto-detection verifies the presence of syslog.h and all required components it provides.

Fixes ticket #12600.
2016-11-10 19:46:52 +03:00
Andrey Semashev
adb7bcf05d Removed the previously deprecated type_info_wrapper. 2016-10-16 17:47:15 +03:00
Andrey Semashev
a74e9d4a74 Added the get_current_file_name method to obtain the current log file
name from the text file sink backend.

Also make sure the close handler is not called when the file is not
open.
2016-10-16 17:37:14 +03:00
Andrey Semashev
084f848d14 Removed an extra space before the month that violated RFC3164. 2016-10-16 15:47:16 +03:00
Andrey Semashev
ea486c1468 Take scalar types and enums by value in streaming operators.
This allows to output static constants and bitfields directly into
formatting stream and record stream. Fixes ticket #11998.
2016-10-08 22:27:34 +03:00
Andrey Semashev
291a7d9509 Added a changelog entry about fixing compilation for Android. 2016-09-30 02:29:28 +03:00
Andrey Semashev
c1e1112575 Added documentation for the max_size_decor decorator. Corrected a few mistakes in the examples. 2016-08-10 00:43:21 +03:00
Andrey Semashev
f15e9d413c Fixed #12178. Stream formatting parameters could be preserved across different log records. 2016-07-17 16:31:24 +03:00
Andrey Semashev
7624cf57b9 Added docs for reliable_message_queue. 2016-07-17 15:43:34 +03:00
Andrey Semashev
25a90aec56 Added a release note about interprocess tools. 2016-05-29 15:18:28 +03:00
Andrey Semashev
f56bf1f510 Updated changelog. 2016-03-25 00:23:25 +03:00
Andrey Semashev
4cd22e1103 Fixes #12025. Added a workaround for MSVC-10 generating broken code for formatters in some cases. 2016-02-27 23:14:27 +03:00
Andrey Semashev
5de58e8a61 Added documentation and comments. 2016-02-25 22:07:29 +03:00
Andrey Semashev
b2ca4e9673 Restored support for basic_string_ref as it is kept present in Boost.Utility for a deprecation period. 2016-02-25 21:24:19 +03:00
Andrey Semashev
353278865b Updated changelog. 2016-02-17 23:35:44 +03:00
Andrey Semashev
953f2f2132 Updated changelog. 2015-12-20 21:57:37 +03:00
Andrey Semashev
b5969e5233 Changed adaptive_mutex to use pthread_mutex_t. On systems that support it (Linux, FreeBSD, OpenBSD) PTHREAD_MUTEX_ADAPTIVE_NP is used, otherwise the default mutex type. This greatly imporoves performance in case of heavy thread contention: 100 threads - x2.7 records per second, 1000 threads - x4. Less contended cases are mostly unaffected. 2015-11-15 17:18:48 +03:00
Andrey Semashev
c7f18fd7ab Replaced BOOST_LOG_USE_WINNT6_API macro with BOOST_USE_WINAPI_VERSION. The target Windows version is now selected with the WinAPI submodule. Also simplified a few preprocessor checks and updated docs. 2015-10-14 22:04:02 +03:00
Andrey Semashev
284d5e6139 Added a workaround for incorrect file name generation in text file sink backend, when the file name contains date/time placeholders. Fixes #11691. 2015-10-04 18:37:05 +03:00
Andrey Semashev
b7de827f23 Fixed compilation of character decorators. Added tests. 2015-09-26 19:20:07 +03:00
Andrey Semashev
ce323aa8c1 Updated changelog. 2015-08-27 17:28:11 +03:00
Andrey Semashev
cfebc1a00b Updated changelog. 2015-08-25 11:39:09 +03:00
Andrey Semashev
44ef109505 Fixed #11541. Fixed compilation when native wchar_t type is disabled. Added a note of discouragement to the configuration section. 2015-08-23 20:30:30 +03:00
Andrey Semashev
c2789a4eff Added a workaround for Solaris Studio 12.4, which should fix the compilation of formatting_ostream. Fixed #11545. 2015-08-23 17:45:49 +03:00
Andrey Semashev
48870b6ffe Updated changelog. 2015-08-23 17:31:47 +03:00
Andrey Semashev
d06dbb866e Moved changes to 1.58 in the changelog. 2015-08-01 17:05:32 +03:00
Andrey Semashev
6a9fa10ee2 Updated changelog. 2015-07-26 00:10:57 +03:00
Andrey Semashev
a1300104c9 Updated changelog. 2015-07-10 22:57:33 +03:00
Andrey Semashev
8d63fe138a Fixed a typo. 2015-07-08 22:59:26 +03:00
Andrey Semashev
30e7f03631 Fixes #11398. Improved the event synchronization primitive.
The updated implementation relies on Boost.Atomic for atomic operations which provides better portability. On Linux the implementation uses futexes directly, which should improve performance slightly. The event implementation choice should be more stable across different compiler versions because of these changes.
2015-07-05 22:00:03 +03:00
Andrey Semashev
c98b1f459a Fixes #11446. Add support for OpenBSD (clock_gettime). 2015-07-05 19:06:18 +03:00
Andrey Semashev
7dea4539d6 Reverted the TLS config enforcement for Boost.ASIO.
Partially reverts 89474f4a80 and a9738b1249. During the discussion on the ML, there was opinion that Boost.Log should not influence other libraries' configuration. This can cause ODR violations and cause surprises to the users.

The long term solution will be removal of Boost.ASIO and re-implementing network abstraction layer. For now users are required to configure each library separately. This requirement has been documented.
2015-07-05 18:52:29 +03:00
Andrey Semashev
83026646a2 Updated changelog. 2015-04-25 22:55:13 +03:00