LogSender Class Reference

Wrapper for the Log IceStorm topic with convenience methods for logging. More...

#include <ArmarXCore/core/logging/LogSender.h>

+ Inheritance diagram for LogSender:

Classes

struct  Impl
 

Public Types

enum  ConsoleColor {
  eReset = -1, eBlack = 0, eRed = 1, eGreen = 2,
  eYellow = 3, eBlue = 4
}
 
using CoutType = std::basic_ostream< char, std::char_traits< char > >
 
typedef void(LogSender::* manipulator) ()
 
typedef CoutType &(* StandardEndLine) (CoutType &)
 

Public Member Functions

void flush ()
 Sends the current message to the log and resets the content. More...
 
MessageTypeT getSeverity ()
 Retrieves the current message severity. More...
 
 LogSender ()
 
 LogSender (const std::string &componentName, LogPrx logProxy)
 Constructor taking a LogPrx pointer to the IceStorm topic. More...
 
LogSenderoperator<< (const IceUtil::Time &timestamp)
 operator << overload for IceUtil::Time More...
 
LogSenderoperator<< (const StandardEndLine &manipulator)
 
LogSenderoperator<< (const std::chrono::microseconds &timestamp)
 
LogSenderoperator<< (const std::chrono::milliseconds &timestamp)
 
LogSenderoperator<< (const std::chrono::minutes &timestamp)
 
LogSenderoperator<< (const std::chrono::nanoseconds &timestamp)
 
LogSenderoperator<< (const std::chrono::seconds &timestamp)
 
template<typename T >
LogSenderoperator<< (const T &message)
 Appends a variable to the current message stringstream. More...
 
LogSenderPtr setBacktrace (bool printBackTrace)
 
LogSenderPtr setFile (const std::string &file)
 Set the source code filename associated with this message. More...
 
LogSenderPtr setFunction (const std::string &function)
 Set the function name associated with this message. More...
 
LogSenderPtr setLine (int line)
 Set the source code line associated with this message. More...
 
LogSenderPtr setLocalMinimumLoggingLevel (MessageTypeT level)
 
LogSenderPtr setTag (const LogTag &tag)
 
LogSenderPtr setThreadId (Ice::Int tid)
 
 ~LogSender ()
 

Static Public Member Functions

static std::string CreateBackTrace (int linesToSkip=1)
 
static LogSenderPtr createLogSender ()
 
static std::string CropFunctionName (const std::string &originalFunctionName)
 
static std::string GetColorCodeString (ConsoleColor colorCode)
 
static std::string GetColorCodeString (MessageTypeT verbosityLevel)
 
static MessageTypeT GetGlobalMinimumLoggingLevel ()
 
static long getProcessId ()
 
static long getThreadId ()
 
template<typename T >
static std::string GetTypeString ()
 
static std::string levelToString (MessageTypeT type)
 
static void SetColoredConsoleActivated (bool activated=true)
 
static void SetComponentName (const std::string &componentName)
 
static void SetGlobalMinimumLoggingLevel (MessageTypeT level)
 With setGlobalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set for the whole application. More...
 
static void SetLoggingActivated (bool activated=true, bool showMessage=true)
 setLoggingActivated() is used to activate or disable the logging facilities in the whole application More...
 
static void SetLoggingGroup (const std::string &loggingGroup)
 
static void setProxy (const std::string &componentName, LogPrx logProxy)
 
static void SetSendLoggingActivated (bool activated=true)
 
static MessageTypeT StringToLevel (const std::string &typeStr)
 stringToLevel converts a string into a LoggingLevel, if possible. More...
 

Protected Member Functions

void log (MessageTypeT severity, std::string message)
 Sends a message to the logging component. More...
 

Detailed Description

Wrapper for the Log IceStorm topic with convenience methods for logging.

Definition at line 66 of file LogSender.h.

Member Typedef Documentation

◆ CoutType

using CoutType = std::basic_ostream<char, std::char_traits<char> >

Definition at line 81 of file LogSender.h.

◆ manipulator

typedef void(LogSender::* manipulator()

Definition at line 78 of file LogSender.h.

◆ StandardEndLine

typedef CoutType&(* StandardEndLine(CoutType &)

Definition at line 84 of file LogSender.h.

Member Enumeration Documentation

◆ ConsoleColor

Enumerator
eReset 
eBlack 
eRed 
eGreen 
eYellow 
eBlue 

Definition at line 69 of file LogSender.h.

Constructor & Destructor Documentation

◆ LogSender() [1/2]

LogSender ( )

Definition at line 100 of file LogSender.cpp.

◆ ~LogSender()

~LogSender ( )

Definition at line 127 of file LogSender.cpp.

+ Here is the call graph for this function:

◆ LogSender() [2/2]

LogSender ( const std::string &  componentName,
LogPrx  logProxy 
)

Constructor taking a LogPrx pointer to the IceStorm topic.

Parameters
componentNameAll log messages sent through this instance will show as having originated from this component.
logProxyIce proxy to send messages to.

Definition at line 114 of file LogSender.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ CreateBackTrace()

std::string CreateBackTrace ( int  linesToSkip = 1)
static

Definition at line 508 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ createLogSender()

LogSenderPtr createLogSender ( )
static

Definition at line 86 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ CropFunctionName()

std::string CropFunctionName ( const std::string &  originalFunctionName)
static

Definition at line 469 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ flush()

void flush ( )

Sends the current message to the log and resets the content.

Definition at line 462 of file LogSender.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetColorCodeString() [1/2]

std::string GetColorCodeString ( ConsoleColor  colorCode)
static

Definition at line 307 of file LogSender.cpp.

◆ GetColorCodeString() [2/2]

std::string GetColorCodeString ( MessageTypeT  verbosityLevel)
static

Definition at line 300 of file LogSender.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGlobalMinimumLoggingLevel()

MessageTypeT GetGlobalMinimumLoggingLevel ( )
static

Definition at line 688 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ getProcessId()

long getProcessId ( )
static

Definition at line 452 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ getSeverity()

MessageTypeT getSeverity ( )

Retrieves the current message severity.

Returns
Current message severity

Definition at line 559 of file LogSender.cpp.

◆ getThreadId()

long getThreadId ( )
static

Definition at line 447 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ GetTypeString()

static std::string GetTypeString ( )
static

◆ levelToString()

std::string levelToString ( MessageTypeT  type)
static

Definition at line 611 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ log()

void log ( MessageTypeT  severity,
std::string  message 
)
protected

Sends a message to the logging component.

Parameters
severityeVERBOSE / eINFO / eWARN / eERROR
message

Definition at line 330 of file LogSender.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [1/8]

LogSender & operator<< ( const IceUtil::Time &  timestamp)

operator << overload for IceUtil::Time

Parameters
timestampIceUtil::Time
Returns

Definition at line 237 of file LogSender.cpp.

+ Here is the call graph for this function:

◆ operator<<() [2/8]

LogSender & operator<< ( const StandardEndLine manipulator)

Definition at line 781 of file LogSender.cpp.

+ Here is the call graph for this function:

◆ operator<<() [3/8]

LogSender & operator<< ( const std::chrono::microseconds &  timestamp)

Definition at line 178 of file LogSender.cpp.

◆ operator<<() [4/8]

LogSender & operator<< ( const std::chrono::milliseconds &  timestamp)

Definition at line 194 of file LogSender.cpp.

◆ operator<<() [5/8]

LogSender & operator<< ( const std::chrono::minutes &  timestamp)

Definition at line 226 of file LogSender.cpp.

◆ operator<<() [6/8]

LogSender & operator<< ( const std::chrono::nanoseconds &  timestamp)

Definition at line 167 of file LogSender.cpp.

◆ operator<<() [7/8]

LogSender & operator<< ( const std::chrono::seconds &  timestamp)

Definition at line 210 of file LogSender.cpp.

◆ operator<<() [8/8]

LogSender& operator<< ( const T message)
inline

Appends a variable to the current message stringstream.

Parameters
message
Returns
This object for further streaming

Definition at line 116 of file LogSender.h.

+ Here is the call graph for this function:

◆ setBacktrace()

LogSenderPtr setBacktrace ( bool  printBackTrace)

Definition at line 588 of file LogSender.cpp.

◆ SetColoredConsoleActivated()

void SetColoredConsoleActivated ( bool  activated = true)
static

Definition at line 713 of file LogSender.cpp.

◆ SetComponentName()

void SetComponentName ( const std::string &  componentName)
static

Definition at line 155 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ setFile()

LogSenderPtr setFile ( const std::string &  file)

Set the source code filename associated with this message.

Parameters
filenameThe file this message was sent from
Returns
a pointer to this object

Definition at line 564 of file LogSender.cpp.

◆ setFunction()

LogSenderPtr setFunction ( const std::string &  function)

Set the function name associated with this message.

Parameters
lineThe function this message was sent from
Returns
a pointer to this object

Definition at line 576 of file LogSender.cpp.

◆ SetGlobalMinimumLoggingLevel()

void SetGlobalMinimumLoggingLevel ( MessageTypeT  level)
static

With setGlobalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set for the whole application.


the flag 'minimumLoggingLevel' overrides this setting.

Parameters
levelThe minimum logging level

Definition at line 677 of file LogSender.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLine()

LogSenderPtr setLine ( int  line)

Set the source code line associated with this message.

Parameters
lineThe line this message was sent from
Returns
a pointer to this object

Definition at line 570 of file LogSender.cpp.

◆ setLocalMinimumLoggingLevel()

LogSenderPtr setLocalMinimumLoggingLevel ( MessageTypeT  level)

Definition at line 582 of file LogSender.cpp.

◆ SetLoggingActivated()

void SetLoggingActivated ( bool  activated = true,
bool  showMessage = true 
)
static

setLoggingActivated() is used to activate or disable the logging facilities in the whole application

Parameters
activated

Definition at line 694 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ SetLoggingGroup()

void SetLoggingGroup ( const std::string &  loggingGroup)
static

Definition at line 161 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ setProxy()

void setProxy ( const std::string &  componentName,
LogPrx  logProxy 
)
static

Definition at line 136 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ SetSendLoggingActivated()

void SetSendLoggingActivated ( bool  activated = true)
static

Definition at line 708 of file LogSender.cpp.

+ Here is the caller graph for this function:

◆ setTag()

LogSenderPtr setTag ( const LogTag tag)

Definition at line 599 of file LogSender.cpp.

◆ setThreadId()

LogSenderPtr setThreadId ( Ice::Int  tid)

Definition at line 593 of file LogSender.cpp.

◆ StringToLevel()

MessageTypeT StringToLevel ( const std::string &  typeStr)
static

stringToLevel converts a string into a LoggingLevel, if possible.

Case-Insensitive

Parameters
typeStrstring that is to be converted
Returns
The LoggingLevel or Undefined if conversion not possible.

Definition at line 641 of file LogSender.cpp.


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