Photon C++ Client API  5.0.7.3
Public Member Functions | List of all members
Logger Class Reference
Inheritance diagram for Logger:
Inheritance graph
[legend]
Collaboration diagram for Logger:
Collaboration graph
[legend]

Public Member Functions

 Logger (int debugLevel=DebugLevel::WARNINGS)
 
virtual ~Logger (void)
 
bool operator== (const Logger &toCompare) const
 
bool operator!= (const Logger &toCompare) const
 
void log (int debugLevel, const EG_CHAR *file, const EG_CHAR *function, bool printBrackets, unsigned int line, const EG_CHAR *dbgMsg,...) const
 
void vlog (int debugLevel, const EG_CHAR *file, const EG_CHAR *function, bool printBrackets, unsigned int line, const EG_CHAR *dbgMsg, va_list args) const
 
int getDebugOutputLevel (void) const
 
bool setDebugOutputLevel (int debugLevel)
 
void setListener (const BaseListener &listener)
 
const LogFormatOptionsgetFormatOptions (void) const
 
void setFormatOptions (const LogFormatOptions &formatOptions)
 
virtual Common::JStringtoString (Common::JString &retStr, bool withTypes=false) const
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const=0
 
JString toString (bool withTypes=false) const
 
- Public Member Functions inherited from ToString
virtual ~ToString (void)
 
virtual JString typeToString (void) const
 
JString toString (bool withTypes=false) const
 

Detailed Description

A Logger instance works as debugging API to send formatted strings to its current listener instance via the EGLOG()-macro.

Constructor & Destructor Documentation

◆ Logger()

Logger ( int  debugLevel = DebugLevel::WARNINGS)

Constructor: Creates a new Logger instance and sets the initial debug level.

Parameters
debugLevelthe minimum debug level that a message must have to actually get logged by this Logger instance (the default is DebugLevel::WARNINGS)

◆ ~Logger()

~Logger ( void  )
virtual

Destructor.

Member Function Documentation

◆ operator==()

bool operator== ( const Logger toCompare) const

operator==.

Returns
true, if both operands are equal, false otherwise. Two instances are treated as equal, if their debug level, listener instance and formatting options are equal.

◆ operator!=()

bool operator!= ( const Logger toCompare) const

operator!=.

Returns
false, if operator==() would return true, true otherwise.

◆ log()

void log ( int  debugLevel,
const EG_CHAR *  file,
const EG_CHAR *  function,
bool  printBrackets,
unsigned int  line,
const EG_CHAR *  dbgMsg,
  ... 
) const

Not intended for direct use - you should use the EGLOG() macro instead!

◆ vlog()

void vlog ( int  debugLevel,
const EG_CHAR *  file,
const EG_CHAR *  function,
bool  printBrackets,
unsigned int  line,
const EG_CHAR *  dbgMsg,
va_list  args 
) const

Not intended for direct use - you should use the EGLOG() macro instead!

◆ getDebugOutputLevel()

int getDebugOutputLevel ( void  ) const

Returns the current level of debug information that's passed on to BaseListener::debugReturn().

Returns
one of the values in DebugLevel
See also
setDebugOutputLevel()

◆ setDebugOutputLevel()

bool setDebugOutputLevel ( int  debugLevel)

Sets the current level of debug information that's passed on to BaseListener::debugReturn().

Parameters
debugLevelone of the values in DebugLevel
Returns
true if the new debug level has been set correctly, false otherwise.
See also
getDebugOutputLevel()

◆ setListener()

void setListener ( const BaseListener listener)

Sets parameter "listener" as receiver for all debug output information, which gets logged by the Logger instance, on which this function has been called.

Parameters
listenera reference to an instance of a subclass of BaseListener
Returns
true if the new debug level has been set correctly, false otherwise.
See also
getDebugOutputLevel()

◆ getFormatOptions()

const LogFormatOptions & getFormatOptions ( void  ) const
Returns
the LogFormatOptions that are used by this instance.
See also
setFormatOptions()

◆ setFormatOptions()

void setFormatOptions ( const LogFormatOptions formatOptions)

Sets the log format options to the supplied value.

Parameters
formatOptionsthe new value to which the log format options will be set
See also
getFormatOptions()

◆ toString() [1/3]

JString & toString ( Common::JString retStr,
bool  withTypes = false 
) const
virtual
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

Implements ToString.

◆ toString() [2/3]

toString
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

◆ toString() [3/3]

JString toString

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.
See also
JString