Qore Logger Module Reference 0.6
Loading...
Searching...
No Matches
Logger::LoggerEventParameter Class Reference

Implements callable parameter which is evaluated in run-time when event is rendered. More...

#include <Logger.qm.dox.h>

Public Member Methods

auto call ()
 Call function with arguments provided. More...
 
 constructor (code func)
 Creates object. More...
 

Detailed Description

Implements callable parameter which is evaluated in run-time when event is rendered.

It may implement logging for stuff which is time consuming to get and would slow program flow in case the logging is actually not performed because of filters or logging levels.

Example:

int ping_voyager(int num) {
try {
# ping voyager #num
...
} except(hash<ExceptionInfo> ex) {
return -1;
}
}
Logger l;
....
l.debug("Voyager 1: ping is %y secs", new LoggerEventParameter(\ping_voyager(), 1));

Member Function Documentation

◆ call()

auto Logger::LoggerEventParameter::call ( )

Call function with arguments provided.

In case of user function call consider surpressing exceptions to return value corresponding to expected formatting parameter (e.g. "%d").

◆ constructor()

Logger::LoggerEventParameter::constructor ( code  func)

Creates object.

Parameters
funcfunction to be called with optional arguments followed