| Qore logger_bin Module 2.0.0

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Qore::Logger::LoggerAppender Class Reference

Abstract class that defines the interface for logger appenders. More...

`#include <QC_LoggerAppender.dox.h>`

Inheritance diagram for Qore::Logger::LoggerAppender:

## Public Member Functions
| addFilter (LoggerFilter filter, bool top=False)
| Adds a filter to the chain.
| close ()
| Releases any resources allocated by the appender and closes it.
| constructor ()
| Creates the object.
| constructor (string name)
| Creates the object.
list< LoggerFilter > | getFilters ()
| Returns the filter chain as a list.
string | getName ()
| Returns the appender name.
*LoggerAppenderQueue | getQueue ()
| Returns async queue or NOTHING when events are processed synchronously.
bool | isOpen ()
| Returns True if the appender is open and therefore active.
| open ()
| Opens logging resources.
bool | post (LoggerEvent event)
| Posts the given event to the output queue.
| processEvent (int type, auto params)
| Processes an event to the physical target.
abstract | processEventImpl (int type, auto params)
| Processes the event to the physical target.
| removeAllFilters ()
| Clears the filter chain by removing all filters.
| removeFilter (LoggerFilter filter)
| Removes the given filter from the filter chain.
| setQueue (*LoggerAppenderQueue queue)
| Sets the appender queue.

## Protected Member Functions
*object | ensureAtomicOperations (int type)
| Returns an object that can be used to ensure atomic operations for appender operations.
bool | pushEvent (int type, auto params)
| Pushes the given event on the queue or calls processEvent() in case of synchronous processing.
abstract auto | serializeImpl (LoggerEvent event)
| Serializes the given event to put in the queue or write to the target device.

## Detailed Description

Abstract class that defines the interface for logger appenders.

Event data (LoggerEvent) are formatted before the record is passed to the target

## Member Function Documentation

## ◆ addFilter()

Qore::Logger::LoggerAppender::addFilter | ( | LoggerFilter | filter,
|  | bool | top = False )

Adds a filter to the chain.

Parameters

  filter | the new filter to add
  top | if True then the filter is added at the start of the filter chain, if False (the default), the filter is added at the end of the chain

Exceptions

  LOGGER-ERROR | thrown if the filter is already in the list

## ◆ constructor()

Qore::Logger::LoggerAppender::constructor | ( | string | name | ) |

Creates the object.

Parameters

  name | the appender name

## ◆ getFilters()

list< LoggerFilter > Qore::Logger::LoggerAppender::getFilters | ( |  | ) |

Returns the filter chain as a list.

Note that appender filter chain may be modified as internal lock is released when copy of list is returned

## ◆ open()

Qore::Logger::LoggerAppender::open | ( |  | ) |

Opens logging resources.

The appender must be opened to accept any logging events

## ◆ post()

bool Qore::Logger::LoggerAppender::post | ( | LoggerEvent | event | ) |

Posts the given event to the output queue.

Invokes filters; when the event is accepted then it is posted to the queue in case of asynchronous processing, or it is immediately logged by the processEvent() method in case of synchronous processing.

See also
  processEvent()

Parameters

  event | the event to post

Returns
  True if the event has been posted, False if not (filtered out, appender inactive, event not accepted on queue, etc)

## ◆ processEvent()

Qore::Logger::LoggerAppender::processEvent | ( | int | type,
|  | auto | params )

Processes an event to the physical target.

See also
  serializeImpl()

Parameters

  type | see `"EVENT_xxx"` constants
  params | processing parameters

## ◆ processEventImpl()

abstract Qore::Logger::LoggerAppender::processEventImpl | ( | int | type,
|  | auto | params )

Processes the event to the physical target.

Must be implemented by non-abstract subclasses

See also
  serializeImpl()

Parameters

  type | see `"EVENT_xxx"` constants
  params | processing parameters

## ◆ pushEvent()

bool Qore::Logger::LoggerAppender::pushEvent | ( | int | type,
|  | auto | params )
| protected

Pushes the given event on the queue or calls processEvent() in case of synchronous processing.

Parameters

  type | the event type
  params | parameters for the event according to the event type

Returns
  True if the event was accepted/processed, False if not

See also
  processEvent()

## ◆ removeFilter()

Qore::Logger::LoggerAppender::removeFilter | ( | LoggerFilter | filter | ) |

Removes the given filter from the filter chain.

Parameters

  filter | the filter to remove

## ◆ serializeImpl()

abstract auto Qore::Logger::LoggerAppender::serializeImpl | ( | LoggerEvent | event | ) |
| protected

Serializes the given event to put in the queue or write to the target device.

The appender implementaion can define any format for serialization. The data are passed to processEvent() method in the `params` argument when `type` is `EVENT_LOG`.

Returns
  the serialized event

## ◆ setQueue()

Qore::Logger::LoggerAppender::setQueue | ( | *LoggerAppenderQueue | queue | ) |

Sets the appender queue.

Data are passed to target device synchronously unless queue is assigned. In this case data are queued and dedicated process will process it asynchronously

Parameters

  queue | the queue to set

Exceptions

  LOGGER-ERROR | thrown if appender is opened

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

- modules/logger_bin/src/QC_LoggerAppender.dox.h