Qore logger_bin Module 2.1.1
Loading...
Searching...
No Matches
Qore::Logger::LoggerEvent Class Reference

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

#include <QC_LoggerEvent.dox.h>

Public Member Methods

 constructor (object logger, LoggerLevel level, string message, *list< auto > msg_args, *hash< CallStackInfo > location_info, *int thread_id, *date time_stamp, *hash< ExceptionInfo > throwable)
 Instantiates a LoggingEvent from the supplied parameters.
 
 constructor (string fqcn, softstring category, LoggerLevel level, string message, *list< auto > msg_args, *hash< CallStackInfo > location_info, *int thread_id, *date time_stamp, *hash< ExceptionInfo > throwable)
 Instantiates a LoggingEvent from the supplied parameters.
 
string getCategoryName ()
 Returns the category name.
 
string getFullQualifiedClassname ()
 Returns the full qualified classname.
 
LoggerLevel getLevel ()
 Returns the level of this event.
 
*hash< CallStackInfo > getLocationInfo ()
 Returns the location information for this logging event.
 
*object getLogger ()
 Returns the logger which created the event.
 
string getMessage ()
 Returns the string message for the logging event.
 
date getRelativeTime ()
 Returns a relative timestamp for the event.
 
int getThreadId ()
 Returns the thread id which is related to event.
 
*hash< ExceptionInfo > getThrowableInfo ()
 Returns throwable info, if any.
 
date getTimeStamp ()
 Returns the event timestamp as an absolute date/time value.
 
int getUniqueId ()
 Generates a globally unique integer identifier and associates it to the event.
 

Static Public Member Methods

static date getStartTime ()
 Returns the time when the application/logger started to calculate relative time.
 
static setStartTime (date time)
 Sets the starting time for relative time.
 

Detailed Description

Abstract class that defines the interface for logger events.

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

Member Function Documentation

◆ constructor() [1/2]

Qore::Logger::LoggerEvent::constructor ( object  logger,
LoggerLevel  level,
string  message,
*list< auto >  msg_args,
*hash< CallStackInfo >  location_info,
*int  thread_id,
*date  time_stamp,
*hash< ExceptionInfo >  throwable 
)

Instantiates a LoggingEvent from the supplied parameters.

The category becomes logger name and fqcn logger class name

Parameters
loggerInstance of the Logger class
levelThe event level
messageThe payload as format for sprintf()
msg_argsThe arguments for formatting
location_infocode location related to logging event
thread_idthread related to the event, Default: gettid()
time_stamplogging event timestamp. Default value is now_us()
throwableThe throwable ExceptionInfo associated with the logging event

◆ constructor() [2/2]

Qore::Logger::LoggerEvent::constructor ( string  fqcn,
softstring  category,
LoggerLevel  level,
string  message,
*list< auto >  msg_args,
*hash< CallStackInfo >  location_info,
*int  thread_id,
*date  time_stamp,
*hash< ExceptionInfo >  throwable 
)

Instantiates a LoggingEvent from the supplied parameters.

Parameters
fqcnname of the caller class.
categoryThe event category.
levelThe event level
messageThe payload as format for sprintf()
msg_argsThe arguments for formatting
location_infocode location related to logging event
thread_idthread related to the event, Default: gettid()
time_stamplogging event timestamp. Default value is now_us()
throwableThe throwable ExceptionInfo associated with the logging event

◆ getMessage()

string Qore::Logger::LoggerEvent::getMessage ( )

Returns the string message for the logging event.

Potential callable references are evaluated. Next the message is rendered using vsprintf() and the result is cached, so the message is rendered only once.

Returns
the rendered message

◆ getRelativeTime()

date Qore::Logger::LoggerEvent::getRelativeTime ( )

Returns a relative timestamp for the event.

Returns a relative date/time value for the amount of time passed from the beginning of execution to the time when the event was constructed.

See also
getStartTime()

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