LibreOffice: XLogger Interface Reference

LibreOffice LibreOffice 7.6 SDK API Reference

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
XLogger Interface Reference

implemented by a component which is able to log events. More...

## Public Member Functions
void | addLogHandler ([in] XLogHandler LogHandler)
| adds the given handler to the list of handlers.
void | removeLogHandler ([in] XLogHandler LogHandler)
| removes the given handler from the list of handlers.
boolean | isLoggable ([in] long Level)
| determines whether logger instance would produce any output for the given level.
void | log ([in] long Level, [in] string Message)
| logs a given message
void | logp ([in] long Level, [in] string SourceClass, [in] string SourceMethod, [in] string Message)
| logs a given message, detailing the source class and method at which the logged event occurred.

## Public Attributes
string | Name
| denotes the name of the logger.
long | Level
| specifies which log events are logged or ignored.

## Detailed Description

implemented by a component which is able to log events.

This interface is roughly designed after the Java Logging API. However, there are some differences, the major ones being:

- There's no support (yet) for filtering log events.
- There ain't no convenience methods for logging.
- There's no localization support.
- Logger instances do not form a hierarchy.

Since
  OOo 2.3

## Member Function Documentation

## ◆ addLogHandler()

void addLogHandler | ( | [in] XLogHandler | LogHandler | ) |

adds the given handler to the list of handlers.

When an event is logged, the logger will create a LogRecord for this event, and pass this record to all registered handlers. Single handlers might or might not log those records at their own discretion, and depending on additional restrictions such as filters specified at handler level.

Note: The log level of the given handler (XLogHandler::Level) will not be touched. In particular, it will not be set to the logger's log level. It's the responsibility of the component which knits a logger with one or more log handlers to ensure that all loggers have appropriate levels set.

Parameters

  LogHandler | the handler to add to the list of handlers. The call is ignored if this parameter is `NULL`.

## ◆ isLoggable()

boolean isLoggable | ( | [in] long | Level | ) |

determines whether logger instance would produce any output for the given level.

The method can be used to optimize performance as maybe complex parameter evaluation in the `log` calls can be omitted if `isLoggable` evaluates to false.

Parameters

  Level | level to be checked against

Returns
  `TRUE` if there would be some output for this XLogger for the given level, `FALSE` otherwise. Note that a return value of `FALSE` could also indicate that the logger does not have any log handlers associated with it.

See also
  addLogHandler
  removeLogHandler

## ◆ log()

void log | ( | [in] long | Level,
|  | [in] string | Message
| ) |  |

logs a given message

Parameters

  Level | the log level of this message. If this level is smaller than the logger's Level attribute, then the call will be ignored.
  Message | the message to log

## ◆ logp()

void logp | ( | [in] long | Level,
|  | [in] string | SourceClass,
|  | [in] string | SourceMethod,
|  | [in] string | Message
| ) |  |

logs a given message, detailing the source class and method at which the logged event occurred.

Parameters

  Level | the log level of this message. If this level is smaller than the logger's Level attribute, then the call will be ignored.
  SourceClass | the source class at which the logged event occurred.
  SourceMethod | the source class at which the logged event occurred.
  Message | the message to log

## ◆ removeLogHandler()

void removeLogHandler | ( | [in] XLogHandler | LogHandler | ) |

removes the given handler from the list of handlers.

Parameters

  LogHandler | the handler to remove from the list of handlers. The call is ignored if this parameter is `NULL`, or if the handler has not previously been added.

## Member Data Documentation

## ◆ Level

long Level
| attribute

specifies which log events are logged or ignored.

See also
  LogLevel

## ◆ Name

string Name
| attributereadonly

denotes the name of the logger.

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

- com/sun/star/logging/XLogger.idl