Commit Graph

163 Commits

Author SHA1 Message Date
Andrey Semashev
ca227bc2f3 Added a link to a more complete example for reading settings from file. 2019-06-25 20:21:27 +03:00
Andrey Semashev
1ce3c06ac6 Added a compilable example for initialization from a settings container.
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.
2019-06-25 20:10:50 +03:00
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
c0d0fd33f3 Added a note about compiler TLS intrinsics not removing Boost.Thread dependency.
Some users mistakenly assumed that enabling compiler TLS intrinsics would
remove the need for Boost.Thread. This added note should remove that confusion.
2019-02-08 17:30:29 +03:00
Adrien
e21753da4e Fixes typo in the tutorial, "formatter" being used in place of "filter" 2019-01-15 14:08:06 +01: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
2fa3e72262 Fixed outdated docs. 2018-06-01 14:06:24 +03:00
Andrey Semashev
66ba4c469f Corrected typos in the docs. 2018-03-07 02:15:26 +03:00
Andrey Semashev
eb3816f828 Added a note that the Boost.Filesystem global locale crash can be worked around by disabling final log file rotation in sinks. 2018-01-17 13:10:20 +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
cdcd5839cd Updated .gitignore to match the new directory structure. 2017-07-07 03:07:43 +03:00
Andrey Semashev
50b7e5c6c5 Moved auto-generated doc files to a separate directory. Marked this directory so that it is not scanned by the inspect tool. 2017-07-07 03:04:34 +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
Daniel James
efec5a69db Add dependency on copied images 2017-01-13 21:47:58 +00:00
Andrey Semashev
e7ef3a099b Updated copyright years. 2017-01-12 13:02:44 +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
f75d1be7ba Nonessential. 2016-11-10 19:51:15 +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
Rene Rivera
de7a2c42cf Add, and update, documentation build targets. 2016-10-07 23:07:34 -05:00
Andrey Semashev
7e76b87987 Updated links to gcc bugs related to LTO. 2016-10-04 21:36:04 +03:00
Andrey Semashev
416ff8541b Removed the note about LTO being fixed in gcc 5.1 because it's not fixed. 2016-10-04 19:38:12 +03:00
Andrey Semashev
291a7d9509 Added a changelog entry about fixing compilation for Android. 2016-09-30 02:29:28 +03:00
Andrey Semashev
3655c652ef Corrected inline code formatting. 2016-08-18 23:44:24 +03:00
Andrey Semashev
aa7bb31c99 Removed the dependency on Boost.Operators. Mark some of the interface functions with constexpr, where possible. 2016-08-10 01:53:34 +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
e830621389 Add .gitignore to avoid tracking auto-generated files. 2016-08-06 17:17:15 +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
3c92751c56 Working on documentation for IPC tools. 2016-06-05 22:28:54 +03:00
Andrey Semashev
25a90aec56 Added a release note about interprocess tools. 2016-05-29 15:18:28 +03:00
Andrey Semashev
24c70e7f29 Cleaned up the Jamfile and added a config macro for disabling IPC queues. Removed -march compiler flags where possible as they may override the user's choice. Removed the log-api feature as it no longer makes sense (the library is configured by enabling/disabling the particular sinks). Some renaming and cleanup. 2016-04-14 19:32:03 +03:00
Andrey Semashev
25c96d32df Added a boostdoc target to unify Boost release docs building. 2016-04-14 19:32:03 +03:00
Lingxi-Li
8d9002cab8 Add text_ipc_message_queue_backend
This new sink backend supports logging messages to an interprocess
message queue.
2016-04-14 19:32:02 +03:00
Andrey Semashev
3d498a0100 Fixed a link to the header reference. 2016-04-04 19:35:05 +03:00