Repository navigation
[Summary]
StormByte Logger is the stream-logging module of the StormByte C++ suite.
It depends directly on StormByte Base 2.1.0 and StormByte-BuildMaster >= 2.1.0. This repository is not Base, Buffer, Config, Crypto, Database, Multimedia, Network or System.
Public headers under StormByte/logger/ cover Log, ThreadedLog, header formats (%L %T %i %c %g), hierarchical components and Scope facades, groups, ANSI colors, temporary formats, human-readable numbers and bytes, redaction of text and numbers, hex dumps (hex / nohex), and binary payloads (std::span<const std::byte>, std::vector<std::byte> and StormByte::Safe::Binary, default Base64). Owned text that crosses the logger DLL boundary uses StormByte::Safe::String / WString; StormByte::Size and StormByte::ByteSize are accepted as payloads. Views and caller-owned std::string are consumed synchronously. group, component and push_format are caller-side factories: a literal binds to const char*, std::string and std::string_view bind to the view, and StormByte::Safe::String binds by identity. The owned text is built in the caller.
From 2.0.0, original Logger sources are dual-licensed: GNU Lesser General Public License v3.0 or later, or a commercial license from the copyright holder. That change does not cover other StormByte modules or third-party material under thirdparty/ (including bundled StormByte Base).
If you landed here from a release link and have not read the tree:
- What this module is, how to build it, and short examples: README.md
- License: dual license LGPL-3.0-or-later or commercial, LICENSE
Added
ENABLE_PGOandENABLE_LTO. Profile-guided optimization trains inpgo-instrand installs this build. Link-time optimization followsENABLE_LTO(default ON) for every build type. Both apply to Logger. Base is not rebuilt.- Release archives include
THIRD-PARTY(notTHIRDPARTY: on Windows and macOS that name is the same path as thethirdparty/directory, so the file never landed in those zips). No third-party object code is compiled into this shared library. StormByte Base is linked at run time and keeps its own notice. PerfTeststrains the hot path, not only lines already dropped by the print floor. Each iteration mixes a level under the floor (no conversion and no throttle), a level that passes the floor and is then refused, and a sparse line that is written. Drop, Sample, Window and a live rate bucket are all exercised, including a scoped facade, a group rule andThreadedLogfrom several threads. Admission therefore has a profile with and without the line lock.
Changed
- CI builds with
ENABLE_LTO=ON,ENABLE_PGO=OFFandENABLE_TEST=ON, then runs ctest. Profile-guided optimization stays on the release workflow. cmake/optimizations.cmakeis the same file as Base. On Release, and only when that language was not set from the outside, it appendsOPTIMIZATION_FLAGS_LINUX,OPTIMIZATION_FLAGS_MACorOPTIMIZATION_FLAGS_WINDOWS. Linux is-O2 -march=x86-64-v3, Apple is-O2 -mcpu=apple-m1, Windows is/O2 /arch:AVX2. There is no/fp:fastand no/EHsc.cmake/pgo.cmakeis the same file as Base, so a forwarded list keeps its semicolons.- Requires StormByte-BuildMaster >= 2.1.0. An older install is not used; the
buildmastersubmodule supplies 2.1.0. - Requires StormByte Base 2.1.0. The build downloads that release archive (
stormbyte_component_url) and links it withBACKEND=binary. The Base submodule is gone. The archive matches this OS and C++ runtime:libstdc++orlibc++on Linux and macOS, no runtime suffix on Windows. Doxygen include path is${BUILDMASTER_INSTALL_INCLUDEDIR}, notthirdparty/StormByte/base/src. - Bumped the project version to 2.0.2.
- Breaking:
Logger::Exceptionno longer formats withstd::format. A message with arguments replaces literal{}throughSafe::String::ReplaceToken, the same rule as Base 2.1.0.what()staysStormByte.Logger: message. An extraException::Pathis the segment underLogger, not the full path.ThrottleErroris still a leaf and adds no segment.
Fixed
-stdlib=libc++and-stdlib=libstdc++do not count as custom C++ flags. If either is the only extra flag, Release still gets-O2and the CPU baseline.- Human-readable numbers keep en_US grouping (
1,000) when the named C++ locale has no thousands separator. musl does not groupen_US.UTF-8, sohumanreadable_numberprinted1000and redaction counted the shorter text. - Part of the port: the DLL does not return a
std::object.std::strong_orderingis not a DLL ABI. clang-cl returns it through a hidden pointer and MSVC does not pass one, so a call into a clang-built Base wrote at address 0. Ordering is compiled by the caller from Base 2.1.0, where those operators areSTORMBYTE_FORCE_INLINE. A signature that must returnstd::(operator std::string) isSTORMBYTE_FORCE_INLINEin the header too. This archive must be built against that Base. cmake/pgo.cmakematches Base. MSVC PGO links with/LTCG:PGINSTRUMENTand/LTCG:PGOPTIMIZE./GENPROFILEalone fails with LNK1220 because the currentlink.exerequires an/LTCGspecification, and CMake's own/LTCGstays off so it does not replace the profile mode. The profile mode isadd_link_optionson this project, notCMAKE_EXE_LINKER_FLAGS. A nestedproject()inherits the cache and its compiler test linkscmTC_*.exe, which was never instrumented, so/LTCG:PGOPTIMIZEaborted with LNK1266 (cmTC_*.pgdmissing). The cache keeps a bare/LTCGso those/GLobjects still link. A static dependency stays LTCG and is optimized by the link that owns the.pgd.- Clang PGO drops
.profrawfiles left by compiler probes before ctest, andllvm-profdata mergeuses-failure-mode=all. A probe writes a few hundred bytes formain, with a padded empty symbol name. The default failure mode isany, so that one file aborted the merge even after the instrumented tests had passed.