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

A live native callback registration, owned through std::unique_ptr (so it is move-only). More...

#include <SzLogging.hpp>

Public Member Functions

virtual ~SzLogRegistration ()=default
 Unregisters the callback unless Unregister() or Leak() already ran.
 SzLogRegistration (const SzLogRegistration &)=delete
SzLogRegistration & operator= (const SzLogRegistration &)=delete
 SzLogRegistration (SzLogRegistration &&)=delete
SzLogRegistration & operator= (SzLogRegistration &&)=delete
virtual void SetLevel (SzLogLevel minLevel)=0
 Changes this callback's minimum level in place (SzLogging_setCallbackLevel).
virtual SzLogLevel Level ()=0
 This callback's current minimum level (SzLogging_getCallbackLevel).
virtual void Unregister ()=0
 Unregisters now (same as destroying the registration). Idempotent.
virtual void Leak ()=0
 Keeps the callback registered (and called) for the rest of the process; the destructor then does nothing and the callback is never freed.

Protected Member Functions

 SzLogRegistration ()=default

Detailed Description

A live native callback registration, owned through std::unique_ptr (so it is move-only).

Destroying it unregisters the callback (RAII):

  • Outside any callback, the destructor calls SzLogging_unregisterCallback and then destroys the std::function before it returns.
  • Inside a callback, the destructor deactivates the callback (it is not called again) and leaks it, leaving the native registration in place (see the CALLBACK LIFETIME notes at the top of this header).

On Senzing 4.5.0, destroy it only while nothing else logs (the usage rule): declare the variable BEFORE the environment so it is destroyed after it, or call SzEnvironment::Destroy() first. Keep the returned pointer in a named variable: discarding it unregisters the callback immediately.

Constructor & Destructor Documentation

◆ ~SzLogRegistration()

virtual senzing::sdk::SzLogRegistration::~SzLogRegistration ( )
virtualdefault

Unregisters the callback unless Unregister() or Leak() already ran.

◆ SzLogRegistration() [1/3]

senzing::sdk::SzLogRegistration::SzLogRegistration ( const SzLogRegistration & )
delete

◆ SzLogRegistration() [2/3]

senzing::sdk::SzLogRegistration::SzLogRegistration ( SzLogRegistration && )
delete

◆ SzLogRegistration() [3/3]

senzing::sdk::SzLogRegistration::SzLogRegistration ( )
protecteddefault

Member Function Documentation

◆ Leak()

virtual void senzing::sdk::SzLogRegistration::Leak ( )
pure virtual

Keeps the callback registered (and called) for the rest of the process; the destructor then does nothing and the callback is never freed.

Its minimum level keeps bounding the effective level.

◆ Level()

virtual SzLogLevel senzing::sdk::SzLogRegistration::Level ( )
nodiscardpure virtual

This callback's current minimum level (SzLogging_getCallbackLevel).

Throws SzConfigurationException: requires Senzing >= 4.5.1 / 4.6.0.

◆ operator=() [1/2]

SzLogRegistration & senzing::sdk::SzLogRegistration::operator= ( const SzLogRegistration & )
delete

◆ operator=() [2/2]

SzLogRegistration & senzing::sdk::SzLogRegistration::operator= ( SzLogRegistration && )
delete

◆ SetLevel()

virtual void senzing::sdk::SzLogRegistration::SetLevel ( SzLogLevel minLevel)
pure virtual

Changes this callback's minimum level in place (SzLogging_setCallbackLevel).

Until it is available, SzLogging::SetDefaultLogLevel changes the default output's level at any time. Throws SzConfigurationException: requires Senzing >= 4.5.1 / 4.6.0.

◆ Unregister()

virtual void senzing::sdk::SzLogRegistration::Unregister ( )
pure virtual

Unregisters now (same as destroying the registration). Idempotent.


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