Senzing C++ SDK
C++ SDK for Senzing v4, patterned after the official C# SDK
Loading...
Searching...
No Matches
SzCoreLogging.hpp
Go to the documentation of this file.
1// SzCoreLogging.hpp -- native-backed SzLogging implementation over the Senzing
2// 4.5.0 libSzLogging C API.
3//
4// Ports the Rust SDK's src/core/logging.rs (sz-rust-sdk v4.5.0); C# has no
5// SzLogging yet. Stateless: every piece of logging state is native, so one
6// process-wide instance serves every environment. Obtain it via
7// SzEnvironment::GetLogging() (which also works after Destroy()); the returned
8// reference stays valid for the life of the process.
9#ifndef SENZING_SDK_CORE_SZCORELOGGING_HPP
10#define SENZING_SDK_CORE_SZCORELOGGING_HPP
11
12#include <memory>
13
15
16namespace senzing::sdk::core {
17
21class SzCoreLogging final : public SzLogging {
22public:
25
26 SzCoreLogging(const SzCoreLogging&) = delete;
28
29 [[nodiscard]] std::unique_ptr<SzLogRegistration> RegisterCallback(
30 const SzLogCallbackOptions& options, SzLogCallback callback) override;
31 [[nodiscard]] std::unique_ptr<SzLogRegistration>
33 SzLogCallback callback) override;
35 SzLogCallback callback) override;
36 void SetDefaultOutput(const SzLogOutput& output) override;
37 [[nodiscard]] SzLogOutput GetDefaultOutput() override;
38 void SetDefaultFormat(SzLogFormat format) override;
39 [[nodiscard]] SzLogFormat GetDefaultFormat() override;
40 void SetDefaultLogLevel(SzLogLevel level) override;
41 [[nodiscard]] SzLogLevel GetDefaultLogLevel() override;
42 [[nodiscard]] SzLogLevel GetEffectiveLogLevel() override;
43
44private:
45 SzCoreLogging() = default;
46 ~SzCoreLogging() override = default;
47};
48
49} // namespace senzing::sdk::core
50
51#endif // SENZING_SDK_CORE_SZCORELOGGING_HPP
Registration parameters: the callback's minimum level and the format native applies to SzLogRecord::M...
Definition SzLogging.hpp:377
Destination of native's default output.
Definition SzLogging.hpp:306
Senzing native logging (libSzLogging).
Definition SzLogging.hpp:657
SzCoreLogging(const SzCoreLogging &)=delete
SzLogLevel GetEffectiveLogLevel() override
The effective level (SzLogging_getLogLevel): the minimum over the default output and every registered...
void SetDefaultLogLevel(SzLogLevel level) override
Sets the default output's level (SzLogging_setLogLevel).
void SetDefaultFormat(SzLogFormat format) override
Sets the default output's format (SzLogging_setDefaultFormatter).
std::unique_ptr< SzLogRegistration > RegisterCallback(const SzLogCallbackOptions &options, SzLogCallback callback) override
Registers callback for messages from every thread (SzLogging_registerCallbackWithFormat).
SzLogFormat GetDefaultFormat() override
The default output's format (SzLogging_getDefaultFormatter).
void SetDefaultCallback(const SzLogCallbackOptions &options, SzLogCallback callback) override
Makes callback the default output, at options.MinLevel() and in options.Format() (SzLogging_setDefaul...
SzLogOutput GetDefaultOutput() override
The current default output (SzLogging_getDefaultOutput).
static SzCoreLogging & GetInstance()
The process-wide instance (logging is process-global native state).
SzCoreLogging & operator=(const SzCoreLogging &)=delete
void SetDefaultOutput(const SzLogOutput &output) override
Sets the default output (SzLogging_setDefaultOutput).
SzLogLevel GetDefaultLogLevel() override
The default output's level, exactly what SetDefaultLogLevel set (SzLogging_getDefaultLogLevel).
std::unique_ptr< SzLogRegistration > RegisterThreadLocalCallback(const SzLogCallbackOptions &options, SzLogCallback callback) override
Registers callback for messages logged on the CALLING OS THREAD only.
Definition SzCoreConfig.hpp:20
std::function< void(const SzLogRecord &)> SzLogCallback
A log callback.
Definition SzLogging.hpp:553
SzLogLevel
Log severity.
Definition SzLogging.hpp:141
SzLogFormat
Message format, applied by native (SZ_LOG_FORMAT_*).
Definition SzLogging.hpp:163