VLink  2.0.0
A high-performance communication middleware
vlink::LoggerPluginInterface Class Referenceabstract

Pure-virtual interface that every shared-library logger backend implements. More...

#include <logger_plugin_interface.h>

Collaboration diagram for vlink::LoggerPluginInterface:

Public Member Functions

virtual bool init (std::string_view app_name)=0
 Initialises the backend immediately after the plugin instance is constructed. More...
 
virtual bool log (int level, std::string_view str)=0
 Writes a single record to the backend. More...
 

Protected Member Functions

 LoggerPluginInterface ()=default
 
virtual ~LoggerPluginInterface ()=default
 

Detailed Description

Pure-virtual interface that every shared-library logger backend implements.

Concrete subclasses use VLINK_PLUGIN_REGISTER internally to expose their factory and destructor functions to the Plugin loader. Instances are owned by the host application for the duration of the plugin handle.

Constructor & Destructor Documentation

◆ LoggerPluginInterface()

vlink::LoggerPluginInterface::LoggerPluginInterface ( )
protecteddefault

◆ ~LoggerPluginInterface()

virtual vlink::LoggerPluginInterface::~LoggerPluginInterface ( )
protectedvirtualdefault

Member Function Documentation

◆ init()

virtual bool vlink::LoggerPluginInterface::init ( std::string_view  app_name)
pure virtual

Initialises the backend immediately after the plugin instance is constructed.

Parameters
app_nameCalling application name; may inform log labels or file paths.
Returns
true on success; false to indicate the plugin must not be used further.

◆ log()

virtual bool vlink::LoggerPluginInterface::log ( int  level,
std::string_view  str 
)
pure virtual

Writes a single record to the backend.

Implementations should be non-blocking; str remains valid only for the duration of the call.

Parameters
levelSeverity using vlink::Logger::Level values.
strFully formatted record.
Returns
true on success; false to indicate a write error.

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