2
0
mirror of https://github.com/boostorg/log.git synced 2026-01-19 04:22:09 +00:00

125 Commits

Author SHA1 Message Date
Andrey Semashev
3efa06b889 Removed disablement of IPC utilities on Cygwin in tests and examples. 2025-12-26 17:22:43 +03:00
Andrey Semashev
ad2eb6c4e5 Added docs, examples and test for wrap_formatter. 2025-07-11 10:28:46 +03:00
Andrey Semashev
86c8cdcced Added a wrap_filter utility.
The wrap_filter helper can be used to inject user-defined filter
functions into Boost.Log filtering expressions.

Added implementation, tests, docs and examples.

Refs https://github.com/boostorg/log/issues/195.
2025-07-11 03:23:01 +03:00
Andrey Semashev
9ee2e2953c Check for native atomic int32 in tests.
If native atomic int32 is not supported, Boost.Log disables IPC utilities,
so make a similar check in tests Jamfile to disable the corresponding tests.
2025-05-31 16:18:13 +03:00
René Ferdinand Rivera Morell
2530a4e03a Add support for modular build structure. (#233)
* Make the library modular usable.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Clean up build dependencies.

* Remove external build references and avoid custom project loading.

* Use relative paths to declare config sub-projects.

* Add missing NO_LIB usage requirements.

* Add missing library ref.

* Add missing import-search for cconfig/predef checks.

* Add requires-b2 check to top-level build file.

* Update dependencies.

* Bump B2 require to 5.2

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Remove custom symbolic project names for config subprojects. And use project root relative targets.

* Move private deps to the build project.

* Put back default boost locale link as locale build is now fixed.

* Set default address-model and architecture to avoid extra/custom detection logic. Put back missing check and config rules.

* Adjust doc build to avoid boost-root references.

* Fix ref to predef.jam location.

* Have B2 build use same deps as CML for per-target private/public.

* Add log dep to log_setup, as it's needed on some platforms.

* Add boost_log_with_support target to mirror CML.

* Fix platform specific winapi dependency spec.
2025-05-26 00:48:16 +03:00
Andrey Semashev
aa0acf366d Create output directory for Message Compiler tool.
Presumably, windmc.exe from MinGW-w64 fails if the output directory
doesn't exist. So create it prior to running the tool.

Additionally, removed explicit markup of the tool outputs as generated
sources. This should be done automatically by add_custom_command.

Also, added the max CMake version to silence its warnings.
2024-12-15 18:40:41 +03:00
Andrey Semashev
26c93dc061 Replaced Boost.Thread synchronization primitives with std equivalents.
This replaces boost::thread and most mutexes and condition variables with
std equivalents. It also adds support for std lock types to the strictest_lock
type trait.

This significantly, although not completely, reduces the dependency on
Boost.Thread.

Refs https://github.com/boostorg/log/issues/232.
2024-08-16 20:01:18 +03:00
Andrey Semashev
9d726cc5fe Switch to C++11 static_assert. 2023-10-01 17:47:29 +03:00
Andrey Semashev
4db6450fe8 Conditionally link with Boost.Regex library, if it's in C++03 mode.
Boost.Log supports compilers that do not qualify as C++11 compilers
for Boost.Regex, even if they are compiling in C++11 mode. In that
case, we still need to link with Boost.Regex v4 prebuilt library.

For more recent compilers, Boost.Regex v5 is used, and that is
a header-only library. This commit removes linking with Boost.Regex
when this is detected at configure time.

Note that only Boost.Build is updated. CMake doesn't need to be
updated since even header-only libraries need to be listed as
dependencies.

Closes https://github.com/boostorg/log/pull/219.
2023-09-25 20:14:34 +03:00
Andrey Semashev
a268b41149 Added a new invoke stream manipulator.
The manipulator allows to inject user's function into a stream output
expression. The manipulator will pass a reference to the stream to
the user's function as the first parameter, optionally followed by
additional arguments passed to the manipulator construction.
2022-02-27 05:43:11 +03:00
Andrey Semashev
8024d7c9c9 Enabled matches with Boost.Xpressive test for gcc 11.2 and newer.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102293 is fixed in gcc 11.2.
2021-12-02 17:57:04 +03:00
Andrey Semashev
2985dfecc0 Added CMake build script and test. 2021-10-30 20:39:49 +03:00
Andrey Semashev
c9b6e2b191 Include Boost.WinAPI config first in tests involving Boost.Regex.
This is needed because Boost.Regex includes windows.h internally,
which causes it to define a different target Windows version than
that is used by Boost.Log, which results in linking errors.

https://github.com/boostorg/regex/issues/154
2021-09-18 03:02:46 +03:00
Andrey Semashev
151d89dd2f Added a workaround for MSVC 8-11 ICE in util_ipc_reliable_mq test. 2021-09-15 23:58:41 +03:00
Andrey Semashev
1ff5a815d4 Fixed include. 2021-09-13 18:13:24 +03:00
Andrey Semashev
6bbe7b90e3 Generate unique IPC queue name in util_ipc_reliable_mq test.
This allows to run multiple instances of the test concurrently in GitHub
Actions CI, e.g. debug and release.

This was also reported in https://github.com/boostorg/log/issues/162.
Closes https://github.com/boostorg/log/issues/162.
2021-09-13 17:56:34 +03:00
Andrey Semashev
ef7476d006 Disable Boost.Xpressive tests on gcc 10+ in C++03 mode.
The compiler ICEs on Boost.Xpressive code in C++03 mode.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102293
2021-09-12 23:28:55 +03:00
Andrey Semashev
699fcc1281 Made channel loggers deep-copy the channel attribute on copy ctor/assignment.
Although attributes are normally only shallow-copied, it is useful to allow
the channel attribute to be deep copied when the parent logger is copied. This
would eliminate the unexpected effect of modifying the channel in the copy, as
it would otherwise affect the original logger. This commit makes copy
constructor and assignment of the channel loggers deep-copy the channel value.

The problem was reported in:

https://stackoverflow.com/questions/66120806/deep-copy-of-boost-logger.

Note that any other attributes that might have been added to the logger are
still shallow copied.
2021-02-10 14:45:52 +03:00
Andrey Semashev
de4e85e9b3 Switched to c++-template-depth feature instead of explicit compiler flags.
This allows to specify the limit for other compilers that support it
and remove it for clang-cl, which doesn't.
2020-09-08 18:23:57 +03:00
Andrey Semashev
4ef885fc7a Moved MSVC C/C++ runtime deprecated macros to a common place.
The _SCL_SECURE_NO_WARNINGS, _SCL_SECURE_NO_DEPRECATE,
_CRT_SECURE_NO_WARNINGS and _CRT_SECURE_NO_DEPRECATE macros need to be
defined for every compiler that uses MSVC C/C++ runtime, so instead of
duplicating these definitions in multiple places, define them for
Windows platform regardless of the compiler. In particular, they are
now defined for clang-cl.
2020-09-08 18:20:13 +03:00
Andrey Semashev
65037a0c2f Added optional_manip output manipulator for formatting optional values. 2020-05-12 01:34:46 +03:00
Andrey Semashev
a2cb720ed1 Added tuple_manip output manipulator for formatting heterogeneous sequences. 2020-05-12 01:33:36 +03:00
Andrey Semashev
15f5f4ed58 Added range_manip output manipulator for formatting ranges. 2020-05-11 23:37:30 +03:00
Andrey Semashev
a79103cb3d Removed linking with Boost.DateTime.
Boost.DateTime is now header-only.
2020-05-05 14:41:56 +03:00
Andrey Semashev
68d38321b3 Updated deprecated uses of boost::bind to silence warnings. 2020-03-04 00:44:23 +03:00
Andrey Semashev
959a97c38b Avoid using deprecated Boost.Test headers. 2019-10-23 13:29:50 +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
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
1138b47fce Removed linking with Boost.System.
Since Boost.System is now header-only, no need to link with the library.
2019-01-14 20:16:20 +03:00
Andrey Semashev
effd8568a4 Disable Boost.Interprocess on Cygwin.
Boost.Interprocess doesn't compile on Cygwin:

https://github.com/boostorg/interprocess/issues/76

Also, disable affected tests and examples.
2019-01-06 19:51:48 +03:00
Andrey Semashev
136fd2bdfd CI compilation fixes for Cygwin and MinGW.
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.
2019-01-06 14:13:32 +03:00
Andrey Semashev
9ddccb5e5c Added env variables that allow to disable building examples and standalone teader tests while testing. 2019-01-05 04:02:01 +03:00
Andrey Semashev
67eef1afba Switch to uncaught_exceptions from Boost.Core.
The implementation in Boost.Core was based in unhandled_exception_count
in Boost.Log, therefore we remove our loca implementation in favor
of the common one.
2018-12-17 19:21:25 +03:00
Andrey Semashev
a51cac7979 Nonessential changes in indentation. 2018-10-15 22:45:48 +03:00
Andrey Semashev
0f62e131cd Silenced a gcc warning about get_attr_value() being declared but not defined. 2017-09-05 18:11:04 +03:00
Andrey Semashev
adb7bcf05d Removed the previously deprecated type_info_wrapper. 2016-10-16 17:47:15 +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
2dc0954e48 Disabled MSVC warning about using this in base initializer list. 2016-08-09 13:50:03 +03:00
Andrey Semashev
6995fd05b3 Silence MSVC warnings about truncating floating point constants. 2016-08-09 13:36:38 +03:00
Andrey Semashev
29347b2ae5 Silence MSVC warnings about truncating character bytes in UTF-8 literals. 2016-08-09 13:27:25 +03:00
Andrey Semashev
70debc533b Changed the max_size decorator so that the overflow marker length is
included into the size limit.
The max_size method on the stream buffer will now attempt to truncate
the attached string on the character boundary.
Fixed character boundary detection for multibyte encodings.
Clean up the overflow flag and the max size limit after the formatter
has completed.
Added a test for the max_size decorator.
Cleaned up some includes and reduced the dependency on Boost.Thread.
2016-08-09 04:20:49 +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
1699351a8b Use the size_type typedef in the autotest. 2016-04-14 19:32:04 +03:00
Andrey Semashev
85092ef741 Added a new queue overflow policy which allows to return an error code if the queue is full. Added a test for the new policy. Changed the interface slightly to use the common message size typedef and use this typedef to check the message size before enqueueing it. 2016-04-14 19:32:04 +03:00
Andrey Semashev
6c49eccaa2 Added another thread to the test. Just to make it more likely to detect issues. 2016-04-14 19:32:04 +03:00
Andrey Semashev
38aeadfcc1 Fixed a few bugs in interprocess condition variable on Windows which caused infinite waits in some cases. 2016-04-14 19:32:04 +03:00
Andrey Semashev
95704fccca Added memory fences to guarantee that the thread-specific data is properly visible to other threads. 2016-04-14 19:32:04 +03:00
Andrey Semashev
5da7f8cf55 Added a test for from_native. 2016-04-14 19:32:04 +03:00
Andrey Semashev
05826649a0 Extracted platform-specific logic regarding interprocess object names to a separate object_name wrapper. Use this wrapper wherever interprocess queue name was used. Added a test for the wrapper. Extracted auto_handle to a separate header. 2016-04-14 19:32:04 +03:00