Logging.h File Reference
#include <boost/current_function.hpp>
#include <ArmarXCore/util/CPPUtility/trace.h>
#include <ArmarXCore/core/logging/LogSender.h>
#include <ArmarXCore/core/util/StringHelpers.h>
+ Include dependency graph for Logging.h:

Go to the source code of this file.

Classes

class  Logging
 Base Class for all Logging classes. More...
 

Namespaces

 armarx
 This file offers overloads of toIce() and fromIce() functions for STL container types.
 

Macros

#define _ARMARX_LOG_INTERNAL_(level)   (checkLogLevel(level)) ? _GlobalDummyLogSender : (*loghelper(__FILE__, __LINE__, ARMARX_FUNCTION)) << level
 
#define _ARMARX_LOG_INTERNAL_S(level)   (level < ::armarx::LogSender::GetGlobalMinimumLoggingLevel()) ? _GlobalDummyLogSender : ARMARX_LOG_S << level
 
#define ARMARX_DEBUG   _ARMARX_LOG_INTERNAL_(::armarx::MessageTypeT::DEBUG)
 
#define ARMARX_DEBUG_S   _ARMARX_LOG_INTERNAL_S(::armarx::MessageTypeT::DEBUG)
 
#define ARMARX_ERROR   _ARMARX_LOG_INTERNAL_(::armarx::MessageTypeT::ERROR)
 
#define ARMARX_ERROR_S   _ARMARX_LOG_INTERNAL_S(::armarx::MessageTypeT::ERROR)
 
#define ARMARX_FATAL   _ARMARX_LOG_INTERNAL_(::armarx::MessageTypeT::FATAL)
 
#define ARMARX_FATAL_S   _ARMARX_LOG_INTERNAL_S(::armarx::MessageTypeT::FATAL)
 
#define ARMARX_FUNCTION   BOOST_CURRENT_FUNCTION
 
#define ARMARX_IMPORTANT   _ARMARX_LOG_INTERNAL_(::armarx::MessageTypeT::IMPORTANT)
 
#define ARMARX_IMPORTANT_S   _ARMARX_LOG_INTERNAL_S(::armarx::MessageTypeT::IMPORTANT)
 
#define ARMARX_INFO   _ARMARX_LOG_INTERNAL_(::armarx::MessageTypeT::INFO)
 
#define ARMARX_INFO_S   _ARMARX_LOG_INTERNAL_S(::armarx::MessageTypeT::INFO)
 
#define ARMARX_LOG   (*ARMARX_LOG_S.setLocalMinimumLoggingLevel(this->Logging::minimumLoggingLevel)) << this->::armarx::Logging::tag
 
#define ARMARX_LOG_S   (*(::armarx::LogSender::createLogSender()->setFile(__FILE__)->setLine(__LINE__)->setFunction(ARMARX_FUNCTION)))
 
#define ARMARX_STREAM_PRINTER   ::armarx::detail::StreamPrinterTag::tag * [&](std::ostream& out)
 use this macro to write output code that is executed when printed and thus not executed if the debug level prevents printing. More...
 
#define ARMARX_VERBOSE   _ARMARX_LOG_INTERNAL_(::armarx::MessageTypeT::VERBOSE)
 
#define ARMARX_VERBOSE_S   _ARMARX_LOG_INTERNAL_S(::armarx::MessageTypeT::VERBOSE)
 
#define ARMARX_WARNING   _ARMARX_LOG_INTERNAL_(::armarx::MessageTypeT::WARN)
 
#define ARMARX_WARNING_S   _ARMARX_LOG_INTERNAL_S(::armarx::MessageTypeT::WARN)
 

Typedefs

using LogSenderPtr = std::shared_ptr< LogSender >
 Typedef of std::shared_ptr for convenience. More...
 
using SpamFilterDataPtr = std::shared_ptr< SpamFilterData >
 

Functions

bool checkLogLevel (armarx::MessageTypeT level)
 
armarx::SpamFilterDataPtr deactivateSpam (const std::string &identifier, float deactivationDurationSec=10.0f, bool deactivate=true)
 
armarx::SpamFilterDataPtr deactivateSpam (float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true)
 
armarx::LogSenderPtr loghelper (const char *file, int line, const char *function)
 

Variables

const armarx::LogSender _GlobalDummyLogSender
 Dummy instance for faster skipped logging (if verbosity level is lower than selected level) - DO NOT USE THIS VARIABLE. More...
 

Macro Definition Documentation

◆ _ARMARX_LOG_INTERNAL_

#define _ARMARX_LOG_INTERNAL_ (   level)    (checkLogLevel(level)) ? _GlobalDummyLogSender : (*loghelper(__FILE__, __LINE__, ARMARX_FUNCTION)) << level

Definition at line 168 of file Logging.h.

◆ _ARMARX_LOG_INTERNAL_S

#define _ARMARX_LOG_INTERNAL_S (   level)    (level < ::armarx::LogSender::GetGlobalMinimumLoggingLevel()) ? _GlobalDummyLogSender : ARMARX_LOG_S << level

Definition at line 166 of file Logging.h.

◆ ARMARX_FUNCTION

#define ARMARX_FUNCTION   BOOST_CURRENT_FUNCTION

Definition at line 122 of file Logging.h.

◆ ARMARX_STREAM_PRINTER

#define ARMARX_STREAM_PRINTER   ::armarx::detail::StreamPrinterTag::tag * [&](std::ostream& out)

use this macro to write output code that is executed when printed and thus not executed if the debug level prevents printing.

In the code you should write to the stream out to output messages.

Example:

{
for (const std::string& elem : someSetOfStrings)
{
if(elem.size() == 5)
{
out << " " << elem << "\n";
}
}
};

This code will only run if the effective debug level is Debug and only entries are printed which satisfy the if condition

Definition at line 304 of file Logging.h.

Function Documentation

◆ checkLogLevel()

bool checkLogLevel ( armarx::MessageTypeT  level)

Definition at line 136 of file Logging.cpp.

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

◆ deactivateSpam() [1/2]

armarx::SpamFilterDataPtr deactivateSpam ( const std::string &  identifier,
float  deactivationDurationSec = 10.0f,
bool  deactivate = true 
)
inline

Definition at line 309 of file Logging.h.

+ Here is the call graph for this function:

◆ deactivateSpam() [2/2]

armarx::SpamFilterDataPtr deactivateSpam ( float  deactivationDurationSec = 10.0f,
const std::string &  identifier = "",
bool  deactivate = true 
)

Definition at line 143 of file Logging.cpp.

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

◆ loghelper()

armarx::LogSenderPtr loghelper ( const char *  file,
int  line,
const char *  function 
)

Definition at line 131 of file Logging.cpp.

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

Variable Documentation

◆ _GlobalDummyLogSender

const armarx::LogSender _GlobalDummyLogSender

Dummy instance for faster skipped logging (if verbosity level is lower than selected level) - DO NOT USE THIS VARIABLE.

Definition at line 124 of file Logging.h.

ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
ARMARX_STREAM_PRINTER
#define ARMARX_STREAM_PRINTER
use this macro to write output code that is executed when printed and thus not executed if the debug ...
Definition: Logging.h:304