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.
 
MessageTypeT getSeverity ()
 Retrieves the current message severity.
 
 LogSender ()
 
 LogSender (const std::string &componentName, LogPrx logProxy)
 Constructor taking a LogPrx pointer to the IceStorm topic.
 
LogSender & operator<< (const IceUtil::Time &timestamp)
 operator << overload for IceUtil::Time
 
LogSender & operator<< (const StandardEndLine &manipulator)
 
LogSender & operator<< (const std::chrono::microseconds &timestamp)
 
LogSender & operator<< (const std::chrono::milliseconds &timestamp)
 
LogSender & operator<< (const std::chrono::minutes &timestamp)
 
LogSender & operator<< (const std::chrono::nanoseconds &timestamp)
 
LogSender & operator<< (const std::chrono::seconds &timestamp)
 
template<typename T>
LogSender & operator<< (const T &message)
 Appends a variable to the current message stringstream.
 
LogSenderPtr setBacktrace (bool printBackTrace)
 
LogSenderPtr setFile (const std::string &file)
 Set the source code filename associated with this message.
 
LogSenderPtr setFunction (const std::string &function)
 Set the function name associated with this message.
 
LogSenderPtr setLine (int line)
 Set the source code line associated with this message.
 
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.
 
static void SetLoggingActivated (bool activated=true, bool showMessage=true)
 setLoggingActivated() is used to activate or disable the logging facilities in the whole application
 
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.
 

Protected Member Functions

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

Detailed Description

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

Member Typedef Documentation

◆ CoutType

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

◆ manipulator

typedef void(LogSender::* manipulator) ()

◆ StandardEndLine

typedef CoutType &(* StandardEndLine) (CoutType &)

Member Enumeration Documentation

◆ ConsoleColor

Enumerator
eReset 
eBlack 
eRed 
eGreen 
eYellow 
eBlue 

Constructor & Destructor Documentation

◆ LogSender() [1/2]

LogSender ( )

◆ ~LogSender()

~LogSender ( )

◆ 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.

Member Function Documentation

◆ CreateBackTrace()

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

◆ createLogSender()

LogSenderPtr createLogSender ( )
static

◆ CropFunctionName()

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

◆ flush()

void flush ( )

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

◆ GetColorCodeString() [1/2]

std::string GetColorCodeString ( ConsoleColor colorCode)
static

◆ GetColorCodeString() [2/2]

std::string GetColorCodeString ( MessageTypeT verbosityLevel)
static

◆ GetGlobalMinimumLoggingLevel()

MessageTypeT GetGlobalMinimumLoggingLevel ( )
static

◆ getProcessId()

long getProcessId ( )
static

◆ getSeverity()

MessageTypeT getSeverity ( )

Retrieves the current message severity.

Returns
Current message severity

◆ getThreadId()

long getThreadId ( )
static

◆ GetTypeString()

template<typename T>
static std::string GetTypeString ( )
static

◆ levelToString()

std::string levelToString ( MessageTypeT type)
static

◆ log()

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

Sends a message to the logging component.

Parameters
severityeVERBOSE / eINFO / eWARN / eERROR
message

◆ operator<<() [1/8]

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

operator << overload for IceUtil::Time

Parameters
timestampIceUtil::Time
Returns

◆ operator<<() [2/8]

LogSender & operator<< ( const StandardEndLine & manipulator)

◆ operator<<() [3/8]

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

◆ operator<<() [4/8]

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

◆ operator<<() [5/8]

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

◆ operator<<() [6/8]

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

◆ operator<<() [7/8]

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

◆ operator<<() [8/8]

template<typename T>
LogSender & operator<< ( const T & message)
inline

Appends a variable to the current message stringstream.

Parameters
message
Returns
This object for further streaming

◆ setBacktrace()

LogSenderPtr setBacktrace ( bool printBackTrace)

◆ SetColoredConsoleActivated()

void SetColoredConsoleActivated ( bool activated = true)
static

◆ SetComponentName()

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

◆ 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

◆ 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

◆ 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

◆ 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

◆ setLocalMinimumLoggingLevel()

LogSenderPtr setLocalMinimumLoggingLevel ( MessageTypeT level)

◆ 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

◆ SetLoggingGroup()

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

◆ setProxy()

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

◆ SetSendLoggingActivated()

void SetSendLoggingActivated ( bool activated = true)
static

◆ setTag()

LogSenderPtr setTag ( const LogTag & tag)

◆ setThreadId()

LogSenderPtr setThreadId ( Ice::Int tid)

◆ 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.

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