Loading...
Searching...
No Matches
Logger::LoggerAppenderQueue Class Reference

Implements queue serializing async appender events. More...

Inheritance diagram for Logger::LoggerAppenderQueue:
[legend]

## Public Member Functions

| 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.

## Protected Member Functions

*hash< auto > | 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< auto > Logger::LoggerAppenderQueue::getEvent | ( | timeout | ms | ) |

protected

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

Parameters

  ms

  a 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

  ms

  a 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

  appender | a logger appender object
  type | see `EVENT_xxx` constants
  params | data prepared by LoggerAppender::serializeImpl()

Returns
  True if the event was succesfully added to queue