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

Public Member Functions

 LogFormatOptions (void)
 
virtual ~LogFormatOptions (void)
 
bool operator== (const LogFormatOptions &toCompare) const
 
bool operator!= (const LogFormatOptions &toCompare) const
 
bool getAddDateTime (void) const
 
LogFormatOptionssetAddDateTime (bool addTime)
 
bool getAddLevel (void) const
 
LogFormatOptionssetAddLevel (bool addLevel)
 
bool getAddFile (void) const
 
LogFormatOptionssetAddFile (bool addFile)
 
bool getAddFunction (void) const
 
LogFormatOptionssetAddFunction (bool addFunction)
 
unsigned int getMaxNumberOfNamespaces (void) const
 
LogFormatOptionssetMaxNumberOfNamespaces (unsigned int maxNumberOfNamespaces)
 
bool getAddLine (void) const
 
LogFormatOptionssetAddLine (bool addLine)
 
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

Used to customize the formatting of the logging output that is generated by the Logger class. Each Logger instance holds its own LogFormatOptions instance that can be set through Logger::setLogFormatOptions().

See also
Logger::getFormatOptions(), Logger::setFormatOptions()

Constructor & Destructor Documentation

◆ LogFormatOptions()

LogFormatOptions ( void  )

Constructor: Creates a new LogFormatOptions instance.

◆ ~LogFormatOptions()

~LogFormatOptions ( void  )
virtual

Destructor.

Member Function Documentation

◆ operator==()

bool operator== ( const LogFormatOptions toCompare) const

operator==.

Returns
true, if both operands are equal, false otherwise. Two instances are treated as equal, if all their public getters return equal values for them.

◆ operator!=()

bool operator!= ( const LogFormatOptions toCompare) const

operator!=.

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

◆ getAddDateTime()

bool getAddDateTime ( void  ) const
Returns
'true', if log lines are prefixed with the date and time of the EGLOG() call, 'false' otherwise.
See also
setAddDateTime()

◆ setAddDateTime()

LogFormatOptions & setAddDateTime ( bool  addTime)

Sets the value of the AddDateTime flag. The default value of this flag is 'true'.

Parameters
addTime'true' instructs the Logger instance to prefix log lines with the date and time of the EGLOG() call, 'false' prevents it from doing so.
See also
getAddDateTime()

◆ getAddLevel()

bool getAddLevel ( void  ) const
Returns
'true', if log lines are prefixed with the DebugLevel of the EGLOG() call, 'false' otherwise.
See also
setAddLevel()

◆ setAddLevel()

LogFormatOptions & setAddLevel ( bool  addLevel)

Sets the value of the AddLevel flag. The default value of this flag is 'true'.

Parameters
addLevel'true' instructs the Logger instance to prefix log lines with the DebugLevel of the EGLOG() call, 'false' prevents it from doing so.
See also
getAddLevel()

◆ getAddFile()

bool getAddFile ( void  ) const
Returns
'true', if log lines are prefixed with the source file of the EGLOG() call, 'false' otherwise.
See also
setAddFile()

◆ setAddFile()

LogFormatOptions & setAddFile ( bool  addFile)

Sets the value of the AddFile flag. The default value of this flag is 'true'.

Parameters
addFile'true' instructs the Logger instance to prefix log lines with the source file of the EGLOG() call, 'false' prevents it from doing so.
See also
getAddFile()

◆ getAddFunction()

bool getAddFunction ( void  ) const
Returns
'true', if log lines are prefixed with the name of the function that did the EGLOG() call, 'false' otherwise.
See also
setAddFunction()

◆ setAddFunction()

LogFormatOptions & setAddFunction ( bool  addFunction)

Sets the value of the AddFunction flag. The default value of this flag is 'true'.

Parameters
addFunction'true' instructs the Logger instance to prefix log lines with the name of the function that did the EGLOG() call, 'false' prevents it from doing so.
See also
getAddFunction()

◆ getMaxNumberOfNamespaces()

unsigned int getMaxNumberOfNamespaces ( void  ) const
Returns
the maximum number of namespaces that are included in the name of the function that did the EGLOG() call.
See also
setMaxNumberOfNamespaces()

◆ setMaxNumberOfNamespaces()

LogFormatOptions & setMaxNumberOfNamespaces ( unsigned int  maxNumberOfNamespaces)

Sets the maximum number of namespaces that are included in the name of the function that did the EGLOG() call. The default value of this option is UINT_MAX, which means that all namespaces should be printed.

Note
The name of the class counts as a namespace in this context and inner namespaces take precedence about outer namespaces.

Example:

The fully qualified name of the class member function includes 3 namespaces and the class name and is CompanyName::ProductName::ProjectName::ClassName::functionName().

  • If the maxNumberOfNamespaces is 0, then the printed function name will be functionName().
  • If the maxNumberOfNamespaces is 1, then the printed function name will be ClassName::functionName().
  • If the maxNumberOfNamespaces is 2, then the printed function name will be ProjectName::ClassName::functionName().
  • If the maxNumberOfNamespaces is 3, then the printed function name will be ProductName::ProjectName::ClassName::functionName().
  • If the maxNumberOfNamespaces is 4, then the printed function name will be CompanyName::ProductName::ProjectName::ClassName::functionName().
  • If the maxNumberOfNamespaces is 5, then the printed function name will still be CompanyName::ProductName::ProjectName::ClassName::functionName().

Usually the values that make the most sense are:

  • UINT_MAX (the fully qualified function name including all namespaces)
  • 0 (just the function name itself)
  • 1 (for class member functions this means the function name and the class name, but no namespaces, while for free functions it means the function name and the name of the most inner namespace, but not the names of any other namespaces)
Remarks
This option is only relevant when the values returend by getAddFunction() is set to 'true' (which is the default).
Parameters
maxNumberOfNamespacesthe maximum number of namespaces
See also
getAddFunction(), setAddFunction(), getMaxNumberOfNamespaces()

◆ getAddLine()

bool getAddLine ( void  ) const
Returns
'true', if log lines are prefixed with the line of the EGLOG() call, 'false' otherwise.
See also
setAddLine()

◆ setAddLine()

LogFormatOptions & setAddLine ( bool  addLine)

Sets the value of the AddLine flag. The default value of this flag is 'true'.

Parameters
addLine'true' instructs the Logger instance to prefix log lines with the line of the EGLOG() call, 'false' prevents it from doing so.
See also
getAddLine()

◆ 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