Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
kcenon::logger::backends::integration_backend Class Referenceabstractexport

Abstract interface for integration backends. More...

#include <integration_backend.h>

Inheritance diagram for kcenon::logger::backends::integration_backend:
Inheritance graph
Collaboration diagram for kcenon::logger::backends::integration_backend:
Collaboration graph

Public Member Functions

virtual ~integration_backend ()=default
 Virtual destructor.
 
virtual log_level normalize_level (int external_level) const =0
 Normalize external log level to internal level.
 
virtual std::string get_backend_name () const =0
 
virtual bool requires_initialization () const
 Check if backend requires special initialization.
 
virtual bool initialize ()
 Initialize the backend.
 
virtual void shutdown ()
 Shutdown the backend.
 
virtual ~integration_backend ()=default
 Virtual destructor.
 
virtual common::interfaces::log_level normalize_level (int external_level) const =0
 Normalize external log level to internal level.
 
virtual std::string get_backend_name () const =0
 Get the backend name.
 
virtual bool requires_initialization () const
 Check if backend requires special initialization.
 
virtual bool initialize ()
 Initialize the backend.
 
virtual void shutdown ()
 Shutdown the backend.
 

Detailed Description

Abstract interface for integration backends.

This interface allows the logger system to integrate with different external systems (e.g., thread_system, common_system) without compile-time conditional compilation. Implementations provide level conversion and optional metrics reporting capabilities.

See also
logger Uses backends for log level normalization
common::interfaces::log_level Level type being normalized
Since
1.2.0

This interface allows the logger system to integrate with different external systems (e.g., thread_system, common_system) without compile-time conditional compilation. Implementations provide level conversion and optional metrics reporting capabilities.

Since
1.2.0

Definition at line 52 of file backends.cppm.

Constructor & Destructor Documentation

◆ ~integration_backend() [1/2]

virtual kcenon::logger::backends::integration_backend::~integration_backend ( )
virtualdefault

◆ ~integration_backend() [2/2]

virtual kcenon::logger::backends::integration_backend::~integration_backend ( )
exportvirtualdefault

Virtual destructor.

Member Function Documentation

◆ get_backend_name() [1/2]

◆ get_backend_name() [2/2]

virtual std::string kcenon::logger::backends::integration_backend::get_backend_name ( ) const
exportpure virtual

Get the backend name.

Returns
Human-readable backend identifier
Since
1.2.0

Implemented in kcenon::logger::backends::standalone_backend, and kcenon::logger::backends::standalone_backend.

◆ initialize() [1/2]

virtual bool kcenon::logger::backends::integration_backend::initialize ( )
inlinevirtual

Initialize the backend.

Returns
true on success, false on failure

Performs any necessary initialization steps for the backend. This method is called during logger construction if requires_initialization() returns true.

Note
Default implementation returns true (no-op).
Since
1.2.0
Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/backends/integration_backend.h, and /home/runner/work/logger_system/logger_system/src/modules/backends.cppm.

Definition at line 114 of file integration_backend.h.

114 {
115 return true;
116 }

◆ initialize() [2/2]

virtual bool kcenon::logger::backends::integration_backend::initialize ( )
inlineexportvirtual

Initialize the backend.

Returns
true on success, false on failure
Since
1.2.0

Definition at line 95 of file backends.cppm.

95 {
96 return true;
97 }

◆ normalize_level() [1/2]

virtual log_level kcenon::logger::backends::integration_backend::normalize_level ( int external_level) const
pure virtual

Normalize external log level to internal level.

Parameters
external_levelExternal system's log level (as integer)
Returns
Normalized log_level for internal use

Converts log levels from external systems to the common::interfaces::log_level enumeration. Different systems may use different level schemes (ascending, descending, different naming), and this method handles the conversion.

Note
The external_level is passed as int to avoid compile-time dependencies on external enum types.
Since
1.2.0

Implemented in kcenon::logger::backends::standalone_backend, and kcenon::logger::backends::standalone_backend.

Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/backends/integration_backend.h, and /home/runner/work/logger_system/logger_system/src/modules/backends.cppm.

◆ normalize_level() [2/2]

virtual common::interfaces::log_level kcenon::logger::backends::integration_backend::normalize_level ( int external_level) const
exportpure virtual

Normalize external log level to internal level.

Parameters
external_levelExternal system's log level (as integer)
Returns
Normalized log_level for internal use

Converts log levels from external systems to the common::interfaces log_level enumeration. Different systems may use different level schemes.

Since
1.2.0

Implemented in kcenon::logger::backends::standalone_backend, and kcenon::logger::backends::standalone_backend.

◆ requires_initialization() [1/2]

virtual bool kcenon::logger::backends::integration_backend::requires_initialization ( ) const
inlinevirtual

Check if backend requires special initialization.

Returns
true if the backend needs initialization

Some backends may require initialization steps (e.g., registering with external systems). This method indicates whether such steps are needed.

Note
Default implementation returns false (no initialization required).
Since
1.2.0

Reimplemented in kcenon::logger::backends::standalone_backend, and kcenon::logger::backends::standalone_backend.

Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/backends/integration_backend.h, and /home/runner/work/logger_system/logger_system/src/modules/backends.cppm.

Definition at line 98 of file integration_backend.h.

98 {
99 return false;
100 }

◆ requires_initialization() [2/2]

virtual bool kcenon::logger::backends::integration_backend::requires_initialization ( ) const
inlineexportvirtual

Check if backend requires special initialization.

Returns
true if the backend needs initialization
Since
1.2.0

Reimplemented in kcenon::logger::backends::standalone_backend, and kcenon::logger::backends::standalone_backend.

Definition at line 85 of file backends.cppm.

85 {
86 return false;
87 }

◆ shutdown() [1/2]

virtual void kcenon::logger::backends::integration_backend::shutdown ( )
inlinevirtual

Shutdown the backend.

Performs any necessary cleanup steps for the backend. This method is called during logger destruction.

Note
Default implementation is a no-op.
Since
1.2.0
Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/backends/integration_backend.h, and /home/runner/work/logger_system/logger_system/src/modules/backends.cppm.

Definition at line 128 of file integration_backend.h.

128 {
129 // Default: no-op
130 }

◆ shutdown() [2/2]

virtual void kcenon::logger::backends::integration_backend::shutdown ( )
inlineexportvirtual

Shutdown the backend.

Since
1.2.0

Definition at line 104 of file backends.cppm.

104 {
105 // Default: no-op
106 }

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