Senzing C++ SDK
C++ SDK for Senzing v4, patterned after the official C# SDK
Loading...
Searching...
No Matches
senzing::sdk::SzLogRecord Class Reference

One log message, borrowed from native for the duration of a callback. More...

#include <SzLogging.hpp>

Public Member Functions

constexpr SzLogRecord (SzLogLevel level, std::string_view rawModule, std::string_view message, std::optional< int64_t > timestampNs=std::nullopt, std::optional< uint64_t > threadID=std::nullopt) noexcept
 Builds a record over native's fields.
constexpr SzLogLevel Level () const noexcept
 The message's severity.
constexpr std::string_view Module () const noexcept
 The module name: native's module up to its last ':' (for "szstatic:82eb15f5faba9bab", "szstatic").
constexpr std::optional< std::string_view > ThreadHash () const noexcept
 The thread hash after the last ':' of native's module ("82eb15f5faba9bab"), if present.
constexpr std::string_view Message () const noexcept
 The message exactly as native formatted it for this registration.
constexpr std::string_view RawModule () const noexcept
 Native's module string, unparsed ("szstatic:82eb15f5faba9bab").
constexpr std::optional< int64_t > TimestampNs () const noexcept
 When native logged the message: UTC nanoseconds since the Unix epoch.
std::optional< std::chrono::system_clock::time_point > Timestamp () const
 When native logged the message (UTC), at the platform's system_clock precision.
constexpr std::optional< uint64_t > ThreadID () const noexcept
 OS id of the thread that logged the message.
SzLogEntry ToEntry () const
 An owned copy, for queues and buffers.

Detailed Description

One log message, borrowed from native for the duration of a callback.

The string_views point at native memory that is valid ONLY during the callback; use ToEntry() to keep an owned copy. Strings are passed through as native's bytes (UTF-8 as native produced them; never re-encoded).

The accessors are named like the C# properties they will become (Level(), Message(), ...), as SzException::ErrorCode() is; this also keeps clear of the Win32 GetMessage macro.

Constructor & Destructor Documentation

◆ SzLogRecord()

senzing::sdk::SzLogRecord::SzLogRecord ( SzLogLevel level,
std::string_view rawModule,
std::string_view message,
std::optional< int64_t > timestampNs = std::nullopt,
std::optional< uint64_t > threadID = std::nullopt )
inlineconstexprnoexcept

Builds a record over native's fields.

rawModule is native's module string ("szstatic:82eb15f5faba9bab").

Member Function Documentation

◆ Level()

SzLogLevel senzing::sdk::SzLogRecord::Level ( ) const
inlinenodiscardconstexprnoexcept

The message's severity.

◆ Message()

std::string_view senzing::sdk::SzLogRecord::Message ( ) const
inlinenodiscardconstexprnoexcept

The message exactly as native formatted it for this registration.

◆ Module()

std::string_view senzing::sdk::SzLogRecord::Module ( ) const
inlinenodiscardconstexprnoexcept

The module name: native's module up to its last ':' (for "szstatic:82eb15f5faba9bab", "szstatic").

◆ RawModule()

std::string_view senzing::sdk::SzLogRecord::RawModule ( ) const
inlinenodiscardconstexprnoexcept

Native's module string, unparsed ("szstatic:82eb15f5faba9bab").

◆ ThreadHash()

std::optional< std::string_view > senzing::sdk::SzLogRecord::ThreadHash ( ) const
inlinenodiscardconstexprnoexcept

The thread hash after the last ':' of native's module ("82eb15f5faba9bab"), if present.

The per-thread handle on Senzing 4.5.0: records from one thread share it.

◆ ThreadID()

std::optional< uint64_t > senzing::sdk::SzLogRecord::ThreadID ( ) const
inlinenodiscardconstexprnoexcept

OS id of the thread that logged the message.

std::nullopt until Senzing >= 4.5.1 / 4.6.0; use ThreadHash() on 4.5.0.

◆ Timestamp()

std::optional< std::chrono::system_clock::time_point > senzing::sdk::SzLogRecord::Timestamp ( ) const
inlinenodiscard

When native logged the message (UTC), at the platform's system_clock precision.

std::nullopt until Senzing >= 4.5.1 / 4.6.0.

◆ TimestampNs()

std::optional< int64_t > senzing::sdk::SzLogRecord::TimestampNs ( ) const
inlinenodiscardconstexprnoexcept

When native logged the message: UTC nanoseconds since the Unix epoch.

std::nullopt until Senzing >= 4.5.1 / 4.6.0.

◆ ToEntry()

SzLogEntry senzing::sdk::SzLogRecord::ToEntry ( ) const
inlinenodiscard

An owned copy, for queues and buffers.


The documentation for this class was generated from the following file: