Qore Logger Module Reference  0.1.1
Logger::LoggerAppenderQueue Class Reference

Implements queue serializing async appender events. More...

Inheritance diagram for Logger::LoggerAppenderQueue:

Public Member Methods

 process (timeout ms=0)
 Processes queued events. More...
 
bool push (LoggerAppender appender, int type, auto params)
 Adds appender event. More...
 
int size ()
 Returns the current number of events waiting in queue.
 

Private Member Methods

*hash getEvent (timeout ms)
 Returns the next event from queue or NOTHING if there is no event available within the timeout period. More...
 

Detailed Description

Implements queue serializing async appender events.

All async events may be processed by one worker thread dedicated to one or more appenders so the thread posting logging event remains unblocked.

Member Function Documentation

◆ getEvent()

*hash Logger::LoggerAppenderQueue::getEvent ( timeout  ms)
private

Returns the next event from queue or NOTHING if there is no event available within the timeout period.

Parameters
msa timeout value to wait for data to become available on the queue; integers are interpreted as milliseconds; relative date/time values are interpreted literally with a maximum resolution of milliseconds. A value that converts to integer 0 causes the call to time out immediately if the call would otherwise block. If a positive timeout argument is passed, and no data is available in the timeout period then waits up to timeout value, If a negative timeout value is passed as the argument, then the call blocks until data is available on the queue.
Returns
the next event from queue or NOTHING if there is no event available within the timeout period

◆ process()

Logger::LoggerAppenderQueue::process ( timeout  ms = 0)

Processes queued events.

This method should typically be called in a dedicated thread

Parameters
msa timeout value to wait for data to become available on the queue; integers are interpreted as milliseconds; relative date/time values are interpreted literally with a maximum resolution of milliseconds. A value that converts to integer 0 causes the call to time out immediately if the call would otherwise block. If a positive timeout argument is passed, and no data is available in the timeout period then waits up to timeout value, If a negative timeout value is passed as the argument, then the call blocks until data is available on the queue. Default value is 0.

◆ push()

bool Logger::LoggerAppenderQueue::push ( LoggerAppender  appender,
int  type,
auto  params 
)

Adds appender event.

Parameters
appendera logger appender object
typesee EVENT_xxx constants
paramsdata prepared by LoggerAppender::serializeImpl()
Returns
True if the event was succesfully added to queue