Pure-virtual interface for a custom logger backend loaded as a dynamic plugin.
更多...
#include <logger_plugin_interface.h>
|
| virtual bool | init (std::string_view app_name)=0 |
| | Initialises the logger backend for the given application name.
|
| virtual bool | log (int level, std::string_view str)=0 |
| | Writes a single log entry to the backend.
|
Pure-virtual interface for a custom logger backend loaded as a dynamic plugin.
Concrete implementations are loaded at runtime by Plugin::load<LoggerPluginInterface>(). The VLINK_PLUGIN_REGISTER macro inside the class body wires up the factory/destroy functions that Plugin uses to manage the lifetime of the plugin instance.
◆ LoggerPluginInterface()
| vlink::LoggerPluginInterface::LoggerPluginInterface |
( |
| ) |
|
|
protecteddefault |
◆ ~LoggerPluginInterface()
| virtual vlink::LoggerPluginInterface::~LoggerPluginInterface |
( |
| ) |
|
|
protectedvirtualdefault |
◆ init()
| virtual bool vlink::LoggerPluginInterface::init |
( |
std::string_view | app_name | ) |
|
|
pure virtual |
Initialises the logger backend for the given application name.
Called once by the host application after the plugin is loaded. The app_name string may be used to label log entries or configure a log file path.
- 参数
-
| app_name | Name of the calling application. |
- 返回
true on success; false if initialisation failed and the plugin should not be used.
◆ log()
| virtual bool vlink::LoggerPluginInterface::log |
( |
int | level, |
|
|
std::string_view | str ) |
|
pure virtual |
Writes a single log entry to the backend.
Called from vlink::Logger internals whenever a log message passes the current log level filter. Implementations should be non-blocking to avoid stalling the caller thread.
- 参数
-
| level | Log severity level. Corresponds to vlink::Logger::Level values (e.g., kDebug, kInfo, kWarn, kError). |
| str | The fully-formatted log message string. |
- 返回
true if the message was written successfully; false on error.
该类的文档由以下文件生成: