libsir 2.2.5
Standard Incident Reporter
Loading...
Searching...
No Matches
sir::policy Class Referenceabstract

Defines the partially abstract interface for a policy which controls the behavior of logger at runtime. More...

Inheritance diagram for sir::policy:
[legend]

Public Member Functions

virtual bool get_init_data (sirinit &data) const noexcept=0
 Called by logger before initializing libsir.
 
virtual bool on_init_complete () const noexcept=0
 Called by logger immediately after libsir has been initialized.
 

Static Public Member Functions

static constexpr bool throw_on_error () noexcept
 Determines whether or not exceptions are thrown in the event that an unercoverable error is encountered by logger or its associated adapter(s).
 

Detailed Description

Defines the partially abstract interface for a policy which controls the behavior of logger at runtime.

Note
Only the default constructors may be used. Other constructors will not be called, and if the default constructor is deleted, compilation errors will result.

Member Function Documentation

◆ get_init_data()

virtual bool sir::policy::get_init_data ( sirinit & data) const
pure virtualnoexcept

Called by logger before initializing libsir.

Provides the policy with an opportunity to customize the initial configuration.

See also
sirinit
sir_makeinit
Note
For the default configuration, pass the address of data to sir_makeinit.
Most, if not all of the options chosen during initialization can be modified post-initialization.
Parameters
dataReference to a sirinit struct representing the initial configuration.
Returns
true if data is ready to pass to sir_init, or false if an error occurred. Returning false will cause logger to abort the initialization process, and possibly throw an exception.

Implemented in sir::default_policy.

◆ on_init_complete()

virtual bool sir::policy::on_init_complete ( ) const
pure virtualnoexcept

Called by logger immediately after libsir has been initialized.

This is the moment in time which should be utilized for further configuration than is possible via sir_init alone.

Some potential actions include:

Returns
true if configuration was completed successfully, or false if an error occurred. Returning false will cause logger to abort the initialization process, and possibly throw an exception.

Implemented in sir::default_policy.

◆ throw_on_error()

static constexpr bool sir::policy::throw_on_error ( )
inlinestaticconstexprnoexcept

Determines whether or not exceptions are thrown in the event that an unercoverable error is encountered by logger or its associated adapter(s).

Note
If exceptions are not enabled, the caller of a method that could potentially fail is responsible for obtaining last error information and reacting accordingly.
Returns
true if logger should throw exceptions, or false if errors should simply be communicated through a pass/fail Boolean return value.

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