Skip to content

Version 2.0.0

Latest

Choose a tag to compare

@StormBytePP StormBytePP released this 29 Sep 20:19

[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<< on Log and ThreadedLog for StormByte::String::String, StormByte::String::WString, StormByte::CString, StormByte::WCString and StormByte::Size. Conversion and copy run only when WillWrite() is true.
  • component, group and push_format accept std::string_view (literals) in the caller and StormByte::String::String by value at the DLL boundary. Manipulator payloads are owned String.
  • Private StormByte::Logger::Detail human-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<< for StormByte::BinaryData and StormByte::ByteSize on Log and ThreadedLog. Conversion runs only when WillWrite() is true.
  • operator<< on StormByte::Shared and StormByte::Unique of Log or ThreadedLog, same sugar as std::shared_ptr: log << "Hola" without a dereference.
  • ~Log and ~ThreadedLog are 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 no STORMBYTE_LOGGER_SHARED CMake option. When the library is shared, the compile definition STORMBYTE_LOGGER_SHARED is still set so visibility.h can distinguish dllexport / dllimport / static. CI passes -DBUILD_SHARED_LIBS=ON. Vendored StormByte-String uses the same shared / static BuildMaster mode and is configured with ENABLE_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::string as an owned cross-module type. Use String / CString when the buffer is owned by another module; string_view remains valid for caller-owned data.
  • LevelToString returns const char* (a string literal) instead of std::string. Call sites that store it in a std::string are unchanged.
  • The private backend is Engine (m_engine), in engine.hxx / engine.cxx. It was Implementation.
  • Filtered payloads (WillWrite() false) return before any conversion or copy. A filtered or throttled std::endl does not touch the stream. An emitted line still forwards real std::endl, so the text is flushed at that instant and the next payload prints a new header. std::endl / std::flush / std::ends are recognized without probing a string stream.
  • Breaking (boundary): Log and ThreadedLog no longer write an std::ostream from inside the DLL. Construction from an std::ostream still works and still requires the stream to outlive the logger. Bytes and manipulators (std::endl) are applied by OStreamWrite / OStreamManip in the module that constructed the logger. A protected constructor takes those callbacks directly.
  • Breaking: ThrottleSpec::Component and ThrottleSpec::Group are std::optional<StormByte::String::String>.
  • Breaking: ill-formed wide text is written as U+FFFD (EF BF BD). Logger does not throw StormByte::UTF8Error on that path.
  • Log::m_scope_path is StormByte::String::String so a copied or derived Log does not carry std::string across a DLL boundary.
  • Numeric and narrow-text payloads share Log::WriteValue; ThreadedLog only overrides BeginPayload for those payloads.
  • StormByte::Base64Encode returns CString (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> and StormByte::BinaryData are formatted with BinaryData::HexDump(N). Text, wide text and numbers still use the 0xAA dump. Without hex, binary payloads stay Base64.
  • Breaking: Logger::Exception takes Exception::Path{"Logger"}. what() is StormByte.Logger: message. Component is gone. ThrottleError is a leaf and adds no segment. Destructors are defined in this module.
  • Breaking: Log is Clonable<Log>, so Clone, Move and Scope return StormByte::Shared<Log> allocated on Base's heap. std::shared_ptr<Log> is no longer a PointerType. Shared still converts to std::shared_ptr<Log> and keeps Base's deleter. The same applies to ThreadedLog.