|
quill
|
This class can be used when you want to run the backend worker on your own thread. More...
#include <ManualBackendWorker.h>
Public Member Functions | |
| ManualBackendWorker (detail::BackendWorker *backend_worker) | |
| ManualBackendWorker (ManualBackendWorker const &)=delete | |
| ManualBackendWorker & | operator= (ManualBackendWorker const &)=delete |
| ManualBackendWorker (ManualBackendWorker &&)=delete | |
| ManualBackendWorker & | operator= (ManualBackendWorker &&)=delete |
| void | init (BackendOptions options) |
| Initializes the ManualBackendWorker with the specified backend options. More... | |
| void | shutdown () |
| Flushes remaining frontend queues and marks the manual backend worker as stopped. More... | |
| void | poll_one () |
| Polls all thread-local SPSC queues and caches the log statements, processing and writing the log statement with the minimum timestamp to the corresponding output sinks. More... | |
| void | poll () |
| Continuously polls the backend worker until all queues are empty. More... | |
| void | poll (std::chrono::microseconds timeout) |
This function behaves like poll() but will stop polling if the specified timeout duration is reached before all queues are emptied. More... | |
This class can be used when you want to run the backend worker on your own thread.
Threading contract:
ManualBackendWorker may log.logger->flush_log() or Frontend::remove_logger_blocking(). If a logger has immediate flush enabled, the implicit flush is skipped for log calls from this thread.init() must also call shutdown() explicitly before it exits. Do not rely on the destructor to perform shutdown for you.
|
inline |
Initializes the ManualBackendWorker with the specified backend options.
This function must be called before any other functions in this class. It configures the backend worker for manual operation, disabling certain options that are incompatible with manual control.
| options | The BackendOptions to configure the backend worker. |
|
inline |
Continuously polls the backend worker until all queues are empty.
This function keeps polling until all frontend queues and cached transit events are processed.
|
inline |
This function behaves like poll() but will stop polling if the specified timeout duration is reached before all queues are emptied.
This can be useful when you want to limit the time spent processing log statements.
|
inline |
Polls all thread-local SPSC queues and caches the log statements, processing and writing the log statement with the minimum timestamp to the corresponding output sinks.
This function should be called periodically by the thread to process and dispatch log entries. It assumes that the init() function has been called first to properly configure the backend worker.
|
inline |
Flushes remaining frontend queues and marks the manual backend worker as stopped.
This function must be called from the same thread that called init() and performs the same shutdown work that the automatic backend thread executes during stop(). Call this explicitly before the manual backend thread exits. Do not rely on the destructor to do this for you.
1.8.13