[Summary]
StormByte Logger is the stream-logging module of the StormByte C++ suite.
It depends on StormByte-String 1.0.0 or newer, which vendors StormByte Base 2.0.0 or newer. This repository is not Base, Buffer, Config, Crypto, Database, Multimedia, Network, String 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>, default Base64). Owned text that crosses the logger DLL boundary uses StormByte::String::String / WString and StormByte::CString / WCString; StormByte::Size, StormByte::ByteSize and StormByte::BinaryData are accepted as payloads. Views and std::string stay on the caller side.
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-String and the Base tree it vendors).
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
operator<<onLogandThreadedLogforStormByte::String::String,StormByte::String::WString,StormByte::CString,StormByte::WCStringandStormByte::Size. Conversion and copy run only whenWillWrite()is true.component,groupandpush_formatacceptstd::string_view(literals) in the caller andStormByte::String::Stringby value at the DLL boundary. Manipulator payloads are ownedString.- Private
StormByte::Logger::Detailhuman-readable number and IEC byte formatting (the manipulator API is unchanged; this logic no longer lives in String). - Tests for owned-text payloads, filtered drop of owned text,
Size, and ill-formed wide input substituted as U+FFFD. operator<<forStormByte::BinaryDataandStormByte::ByteSizeonLogandThreadedLog. Conversion runs only whenWillWrite()is true.operator<<onStormByte::SharedandStormByte::UniqueofLogorThreadedLog, same sugar asstd::shared_ptr:log << "Hola"without a dereference.~Logand~ThreadedLogare defined in the library, so the backend and the line lock are released inside the DLL. Copy and move assignment are too.
Changed
- Shared vs static follows CMake
BUILD_SHARED_LIBS(declared in the project root, default ON). There is noSTORMBYTE_LOGGER_SHAREDCMake option. When the library is shared, the compile definitionSTORMBYTE_LOGGER_SHAREDis still set sovisibility.hcan distinguishdllexport/dllimport/ static. CI passes-DBUILD_SHARED_LIBS=ON. Vendored StormByte-String uses the sameshared/staticBuildMaster mode and is configured withENABLE_TEST=OFF. - Breaking: the bundled dependency is StormByte-String 1.0.0, which vendors StormByte Base 2.0.0. Logger no longer submodules Base directly.
- Breaking: public streaming no longer treats
std::stringas an owned cross-module type. UseString/CStringwhen the buffer is owned by another module;string_viewremains valid for caller-owned data. LevelToStringreturnsconst char*(a string literal) instead ofstd::string. Call sites that store it in astd::stringare unchanged.- The private backend is
Engine(m_engine), inengine.hxx/engine.cxx. It wasImplementation. - Filtered payloads (
WillWrite()false) return before any conversion or copy. A filtered or throttledstd::endldoes not touch the stream. An emitted line still forwards realstd::endl, so the text is flushed at that instant and the next payload prints a new header.std::endl/std::flush/std::endsare recognized without probing a string stream. - Breaking (boundary):
LogandThreadedLogno longer write anstd::ostreamfrom inside the DLL. Construction from anstd::ostreamstill works and still requires the stream to outlive the logger. Bytes and manipulators (std::endl) are applied byOStreamWrite/OStreamManipin the module that constructed the logger. A protected constructor takes those callbacks directly. - Breaking:
ThrottleSpec::ComponentandThrottleSpec::Grouparestd::optional<StormByte::String::String>. - Breaking: ill-formed wide text is written as U+FFFD (
EF BF BD). Logger does not throwStormByte::UTF8Erroron that path. Log::m_scope_pathisStormByte::String::Stringso a copied or derivedLogdoes not carrystd::stringacross a DLL boundary.- Numeric and narrow-text payloads share
Log::WriteValue;ThreadedLogonly overridesBeginPayloadfor those payloads. StormByte::Base64EncodereturnsCString(Base 2.0.0). Binary-span default output is unchanged for the reader.- License: original Logger sources are dual-licensed LGPL-3.0-or-later or commercial. Third-party trees under
thirdparty/keep their own licenses. Neither license grants patent rights. - Breaking: with
hex(N)active,std::span<const std::byte>,std::vector<std::byte>andStormByte::BinaryDataare formatted withBinaryData::HexDump(N). Text, wide text and numbers still use the0xAAdump. Withouthex, binary payloads stay Base64. - Breaking:
Logger::ExceptiontakesException::Path{"Logger"}.what()isStormByte.Logger: message.Componentis gone.ThrottleErroris a leaf and adds no segment. Destructors are defined in this module. - Breaking:
LogisClonable<Log>, soClone,MoveandScopereturnStormByte::Shared<Log>allocated on Base's heap.std::shared_ptr<Log>is no longer aPointerType.Sharedstill converts tostd::shared_ptr<Log>and keeps Base's deleter. The same applies toThreadedLog.