| Qore Logger Module Reference 1.0

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

Class handling a LoggerInterface object as a member and providing atomic logging through it. More...

## Public Member Functions
| assertLog (bool assertion, string message,...)
| Performs logging of assertions.
| constructor ()
| Creates the object with no logger.
| constructor (LoggerInterface logger)
| Creates the object with a logger.
| debug (string message,...)
| Logs a message object with the DEBUG level.
| debugVar (string var_name, auto value)
| Logs the variable name and value using DEBUG level.
*LoggerLevel | decLevel ()
| Decrement logger level.
| detail (string message,...)
| Logs a message object with the DETAIL level.
| error (string message,...)
| Logs a message object with the ERROR level.
| fatal (string message,...)
| Logs a message object with the FATAL level.
*LoggerLevel | getLevel (bool effective=True)
| Returns the logging level.
*LoggerLevel | incLevel ()
| Increment logger level.
| info (string message,...)
| Logs a message object with the INFO level.
bool | isDebugEnabled ()
| Checks whether this Logger is enabled for the DEBUG Level.
bool | isEnabledFor (int level)
| Checks whether this Logger is enabled for a given Level passed as parameter.
bool | isEnabledFor (LoggerLevel level)
| Checks whether this Logger is enabled for a given Level passed as parameter.
bool | isEnabledFor (string level)
| Checks whether this Logger is enabled for a given Level passed as parameter.
bool | isErrorEnabled ()
| Checks whether this Logger is enabled for the ERROR Level.
bool | isFatalEnabled ()
| Checks whether this Logger is enabled for the FATAL Level.
bool | isInfoEnabled ()
| Checks whether this Logger is enabled for the INFO Level.
bool | isLogger (LoggerInterface logger)
| Returns True if the passed logger is the logger used to log, False if not.
bool | isTraceEnabled ()
| Checks whether this Logger is enabled for the TRACE Level.
bool | isWarnEnabled ()
| Checks whether this Logger is enabled for the WARN Level.
| log (int level, string message,...)
| Logs a message using the provided logging level if a logger is set.
| log (Qore::Logger::LoggerLevel level, string message,...)
| Logs a message using the provided logging level if a logger is set.
| log (string level, string message,...)
| Logs a message using the provided logging level if a logger is set.
| logArgs (int level, string message, *softlist< auto > args)
| Logs a message using the provided logging level and a single argument for any format string arguments.
| logArgs (Qore::Logger::LoggerLevel level, string message, *softlist< auto > args)
| Logs a message using the provided logging level and a single argument for any format string arguments.
| logArgs (string level, string message, *softlist< auto > args)
| Logs a message using the provided logging level and a single argument for any format string arguments.
| logEvent (LoggerEvent event)
| Logs an already prepared logging event object.
| setLevel (*LoggerLevel level)
| Sets the logging level.
| setLevel (int level)
| Sets the logging level.
| setLevel (string level)
| Sets the logging level.
| setLogger (*LoggerInterface logger)
| Accepts a LoggerInterface object for logging (or clears it)
| trace (string message,...)
| Logs a message object with the TRACE level.
| traceVar (string var_name, auto value)
| Logs the variable name and value using TRACE level.
| warn (string message,...)
| Logs a message object with the WARN level.

## Protected Member Functions
*LoggerInterface | getLogger ()
| Returns the logger interface for logging.

## Protected Attributes
transient *LoggerInterface | logger
| The logger interface.

## Detailed Description

Class handling a LoggerInterface object as a member and providing atomic logging through it.

## Member Function Documentation

## ◆ assertLog()

Logger::LoggerWrapper::assertLog | ( | bool | assertion,
|  | string | message,
|  |  | ... )

Performs logging of assertions.

If the assertion parameter is False, then the message is logged using the ERROR level.

See also
  log()

Parameters

  assertion | the boolean assertion value
  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ debug()

Logger::LoggerWrapper::debug | ( | string | message,
|  |  | ... )

Logs a message object with the DEBUG level.

See also
  log()

Parameters

  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ debugVar()

Logger::LoggerWrapper::debugVar | ( | string | var_name,
|  | auto | value )

Logs the variable name and value using DEBUG level.

See also
  log()

Parameters

  var_name | the variable name
  value | the value of the variable

## ◆ decLevel()

*LoggerLevel Logger::LoggerWrapper::decLevel | ( |  | ) |

Decrement logger level.

Returns
  current `LoggerLevel`

## ◆ detail()

Logger::LoggerWrapper::detail | ( | string | message,
|  |  | ... )

Logs a message object with the DETAIL level.

See also
  log()

Parameters

  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ error()

Logger::LoggerWrapper::error | ( | string | message,
|  |  | ... )

Logs a message object with the ERROR level.

See also
  log()

Parameters

  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ fatal()

Logger::LoggerWrapper::fatal | ( | string | message,
|  |  | ... )

Logs a message object with the FATAL level.

See also
  log()

Parameters

  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ getLevel()

*LoggerLevel Logger::LoggerWrapper::getLevel | ( | bool | effective = True | ) |

Returns the logging level.

Parameters

  effective | if False then get current level which can be NOTHING, if True then get level which might be inherited from parent, Default: True

Exceptions

  LOGGER-ERROR | if cannot get effective level from hierarchy

## ◆ incLevel()

*LoggerLevel Logger::LoggerWrapper::incLevel | ( |  | ) |

Increment logger level.

Returns
  current `LoggerLevel`

## ◆ info()

Logger::LoggerWrapper::info | ( | string | message,
|  |  | ... )

Logs a message object with the INFO level.

See also
  log()

Parameters

  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ isEnabledFor() [1/3]

bool Logger::LoggerWrapper::isEnabledFor | ( | int | level | ) |

Checks whether this Logger is enabled for a given Level passed as parameter.

Parameters

  level | the log level to check

## ◆ isEnabledFor() [2/3]

bool Logger::LoggerWrapper::isEnabledFor | ( | LoggerLevel | level | ) |

Checks whether this Logger is enabled for a given Level passed as parameter.

Parameters

  level | the log level to check

## ◆ isEnabledFor() [3/3]

bool Logger::LoggerWrapper::isEnabledFor | ( | string | level | ) |

Checks whether this Logger is enabled for a given Level passed as parameter.

Parameters

  level | the log level to check

## ◆ log() [1/3]

Logger::LoggerWrapper::log | ( | int | level,
|  | string | message,
|  |  | ... )

Logs a message using the provided logging level if a logger is set.

Parameters

  level | the logging level.
  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ log() [2/3]

Logger::LoggerWrapper::log | ( | Qore::Logger::LoggerLevel | level,
|  | string | message,
|  |  | ... )

Logs a message using the provided logging level if a logger is set.

Parameters

  level | The logging level.
  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ log() [3/3]

Logger::LoggerWrapper::log | ( | string | level,
|  | string | message,
|  |  | ... )

Logs a message using the provided logging level if a logger is set.

Parameters

  level | The logging level.
  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ logArgs() [1/3]

Logger::LoggerWrapper::logArgs | ( | int | level,
|  | string | message,
|  | *softlist< auto > | args )

Logs a message using the provided logging level and a single argument for any format string arguments.

Logging is only performed if a logger is set

Parameters

  level | the logging level.
  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.
  args | any format string arguments to the log message

## ◆ logArgs() [2/3]

Logger::LoggerWrapper::logArgs | ( | Qore::Logger::LoggerLevel | level,
|  | string | message,
|  | *softlist< auto > | args )

Logs a message using the provided logging level and a single argument for any format string arguments.

Logging is only performed if a logger is set

Parameters

  level | The logging level.
  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.
  args | any format string arguments to the log message

## ◆ logArgs() [3/3]

Logger::LoggerWrapper::logArgs | ( | string | level,
|  | string | message,
|  | *softlist< auto > | args )

Logs a message using the provided logging level and a single argument for any format string arguments.

Logging is only performed if a logger is set

Parameters

  level | The logging level.
  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.
  args | any format string arguments to the log message

## ◆ logEvent()

Logger::LoggerWrapper::logEvent | ( | LoggerEvent | event | ) |

Logs an already prepared logging event object.

Parameters

  event | the event to log

## ◆ setLevel() [1/3]

Logger::LoggerWrapper::setLevel | ( | *LoggerLevel | level | ) |

Sets the logging level.

Parameters

  level | if nothing then inherits level from parent

## ◆ setLevel() [2/3]

Logger::LoggerWrapper::setLevel | ( | int | level | ) |

Sets the logging level.

Parameters

  level | the logging level to set

## ◆ setLevel() [3/3]

Logger::LoggerWrapper::setLevel | ( | string | level | ) |

Sets the logging level.

Parameters

  level | the logging level as a string

## ◆ trace()

Logger::LoggerWrapper::trace | ( | string | message,
|  |  | ... )

Logs a message object with the TRACE level.

See also
  log()

Parameters

  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.

## ◆ traceVar()

Logger::LoggerWrapper::traceVar | ( | string | var_name,
|  | auto | value )

Logs the variable name and value using TRACE level.

See also
  log()

Parameters

  var_name | the variable name
  value | the value of the variable

## ◆ warn()

Logger::LoggerWrapper::warn | ( | string | message,
|  |  | ... )

Logs a message object with the WARN level.

See also
  log()

Parameters

  message | a string to log used as a format string for vsprintf(). Optional arguments are passed to the Qore::Logger::LoggerEvent object. If the last parameter is an ExceptionInfo typed hash, then it is considered "throwable" information.