loggingMACROS.h File Reference

#include "loggingLogger.h"
#include "loggingLogTrace.h"
#include "loggingGetLogger.h"
#include <iostream>
#include <acsutilTimeStamp.h>
Include dependency graph for loggingMACROS.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define LOG(priority, routine, text)
#define LOG_FULL(logPriority, logRoutine, logMessage, logAudience, logArray, logAntenna)
#define LOG_WITH_ANTENNA_CONTEXT(logPriority, logRoutine, logMessage, logArray, logAntenna)
#define LOG_TO_AUDIENCE(logPriority, logRoutine, logMessage, logAudience)
#define LOG_RECORD(logPriority, logMessage, logFile, logLine, logRoutine, logTime, logSource)
#define LOG_GLOBAL_RECORD(logPriority, logMessage, logFile, logLine, logRoutine, logTime)
#define STATIC_LOG(priority, routine, text)   Logging::Logger::getStaticLogger()->log(priority, text, __FILE__, __LINE__, routine);
#define STATIC_LOG_RECORD(logPriority, logMessage, logFile, logLine, logRoutine, logTime)
#define AUTO_TRACE(routine)   Logging::LogTrace::LogTraceSmartPtr __autoTraceLogTraceSmartPtrInstance(new Logging::LogTrace(getLogger(), routine, __FILE__, __LINE__));
#define AUTO_STATIC_TRACE(routine)   Logging::LogTrace::LogTraceSmartPtr __autoTraceLogTraceSmartPtrInstance(new Logging::LogTrace(Logging::Logger::getStaticLogger(), routine, __FILE__, __LINE__));

Define Documentation

#define AUTO_STATIC_TRACE ( routine   )     Logging::LogTrace::LogTraceSmartPtr __autoTraceLogTraceSmartPtrInstance(new Logging::LogTrace(Logging::Logger::getStaticLogger(), routine, __FILE__, __LINE__));

This macro is static version of AUTO_TRACE macro that can be used inside a static methods where AUTO_TRACE does not work (it does not compile). For details see description of AUTO_TRACE macro.

Parameters:
routine Name of the routine in which this macro is being used from (std::string)
#define AUTO_TRACE ( routine   )     Logging::LogTrace::LogTraceSmartPtr __autoTraceLogTraceSmartPtrInstance(new Logging::LogTrace(getLogger(), routine, __FILE__, __LINE__));

This macro creates a LogTrace object which in turn logs a trace message where it is immediately declared and then logs another trace message when it is destroyed. It can only be used once per namespace.

Parameters:
routine Name of the routine in which this macro is being used from (std::string)
#define LOG ( priority,
routine,
text   ) 
Value:
if (getLogger()!=0) \
{ \
  getLogger()->log(priority, text, __FILE__, __LINE__, routine); \
} \
else \
{ \
  std::cerr << "SEVERE LOGGING ERROR - getLogger() returned NULL: file="; \
  std::cerr << __FILE__ << ", line=" << __LINE__ << std::endl; \
}

Used to send logs. This macro is primarily useful because it automatically determines the file name and line number for the developer. It is important to note that getLogger() is defined in a header file other than what's included above. UPDATE: I just included the file, don't know why it wasn't included before.

Parameters:
priority Logging::BaseLog::Priority of the log message
routine Name of the routine in which this macro is being used from (std::string)
text Log message (std::string)
#define LOG_FULL ( logPriority,
logRoutine,
logMessage,
logAudience,
logArray,
logAntenna   ) 
Value:
if (getLogger()!=0) \
{ \
    Logging::BaseLog::LogRecord lr; \
    lr.priority  = Logging::ace2acsPriority(logPriority); \
    lr.message   = logMessage; \
    lr.file      = __FILE__; \
    lr.line      = __LINE__; \
    lr.method    = logRoutine; \
    lr.timeStamp = getTimeStamp(); \
    LoggingProxy::audience(logAudience); \
    LoggingProxy::array(logArray); \
    LoggingProxy::antenna(logAntenna); \
    LoggingProxy::Flags(LM_SOURCE_INFO | LM_RUNTIME_CONTEXT); \
    getLogger()->log(lr); \
         LoggingProxy::audience(NULL); \
} \
else \
{ \
  std::cerr << "SEVERE LOGGING ERROR - getLogger() returned NULL: file="; \
  std::cerr << __FILE__ << ", line=" << __LINE__ << std::endl; \
}

Used to send logs. This macro is primarily useful because it automatically determines the file name and line number for the developer.

Parameters:
logPriority Logging::BaseLog::Priority of the log message
logRoutine Name of the routine in which this macro is being used from (std::string)
logMessage Log message (std::string)
logAudience intended receiver of this log message
logArray array where the log was generated
logAntenna antenna where the log was generated
#define LOG_GLOBAL_RECORD ( logPriority,
logMessage,
logFile,
logLine,
logRoutine,
logTime   ) 
Value:
if (getLogger()!=0) \
{ \
    Logging::BaseLog::LogRecord lr; \
    lr.priority  = logPriority; \
    lr.message   = logMessage; \
    lr.file      = logFile; \
    lr.line      = logLine; \
    lr.method    = logRoutine; \
    lr.timeStamp = logTime; \
    getLogger()->log(lr); \
} \
else \
{ \
  std::cerr << "SEVERE LOGGING ERROR - getLogger() returned NULL: file="; \
  std::cerr << logFile << ", line=" << logLine << std::endl; \
}

Used to publish a log record to the global logger. Useful for doing things like setting a specific time the log was sent (rather than letting ACS figure this out for you).

Parameters:
logPriority ACS priority of the log.
logMessage Log message (string).
logFile Name of the file the log was published from (__FILE__)
logLine Line number from where the log was published (__LINE__)
logRoutine Name of the routine from where the log was published (string)
logTime Time the log was published (ACS::Time)
#define LOG_RECORD ( logPriority,
logMessage,
logFile,
logLine,
logRoutine,
logTime,
logSource   ) 
Value:
if (getLogger()!=0) \
{ \
    Logging::BaseLog::LogRecord lr; \
    lr.priority  = logPriority; \
    lr.message   = logMessage; \
    lr.file      = logFile; \
    lr.line      = logLine; \
    lr.method    = logRoutine; \
    lr.timeStamp = logTime; \
    getNamedLogger(logSource)->log(lr); \
} \
else \
{ \
  std::cerr << "SEVERE LOGGING ERROR - getLogger() returned NULL: file="; \
  std::cerr << logFile << ", line=" << logLine << std::endl; \
}

Used to publish a log record. Useful for doing things like setting a specific time the log was sent (rather than letting ACS figure this out for you).

Parameters:
logPriority ACS priority of the log.
logMessage Log message (string).
logFile Name of the file the log was published from (__FILE__)
logLine Line number from where the log was published (__LINE__)
logRoutine Name of the routine from where the log was published (string)
logTime Time the log was published (ACS::Time)
logSource Source of the log (i.e., container name, component name, etc)
#define LOG_TO_AUDIENCE ( logPriority,
logRoutine,
logMessage,
logAudience   ) 
Value:
if (getLogger()!=0) \
{ \
    Logging::BaseLog::LogRecord lr; \
    lr.priority  = Logging::ace2acsPriority(logPriority); \
    lr.message   = logMessage; \
    lr.file      = __FILE__; \
    lr.line      = __LINE__; \
    lr.method    = logRoutine; \
    lr.timeStamp = getTimeStamp(); \
    LoggingProxy::audience(logAudience); \
    LoggingProxy::Flags(LM_SOURCE_INFO | LM_RUNTIME_CONTEXT); \
    getLogger()->log(lr); \
         LoggingProxy::audience(NULL); \
} \
else \
{ \
  std::cerr << "SEVERE LOGGING ERROR - getLogger() returned NULL: file="; \
  std::cerr << __FILE__ << ", line=" << __LINE__ << std::endl; \
}

Used to send logs. This macro is primarily useful because it automatically determines the file name and line number for the developer.

Parameters:
logPriority Logging::BaseLog::Priority of the log message
logRoutine Name of the routine in which this macro is being used from (std::string)
logMessage Log message (std::string)
logAudience intended receiver of this log message
#define LOG_WITH_ANTENNA_CONTEXT ( logPriority,
logRoutine,
logMessage,
logArray,
logAntenna   ) 
Value:
if (getLogger()!=0) \
{ \
    Logging::BaseLog::LogRecord lr; \
    lr.priority  = Logging::ace2acsPriority(logPriority); \
    lr.message   = logMessage; \
    lr.file      = __FILE__; \
    lr.line      = __LINE__; \
    lr.method    = logRoutine; \
    lr.timeStamp = getTimeStamp(); \
    LoggingProxy::array(logArray); \
    LoggingProxy::antenna(logAntenna); \
    LoggingProxy::Flags(LM_SOURCE_INFO | LM_RUNTIME_CONTEXT); \
    getLogger()->log(lr); \
} \
else \
{ \
  std::cerr << "SEVERE LOGGING ERROR - getLogger() returned NULL: file="; \
  std::cerr << __FILE__ << ", line=" << __LINE__ << std::endl; \
}

Used to send logs. This macro is primarily useful because it automatically determines the file name and line number for the developer.

Parameters:
logPriority Logging::BaseLog::Priority of the log message
logRoutine Name of the routine in which this macro is being used from (std::string)
logMessage Log message (std::string)
logArray array where the log was generated
logAntenna antenna where the log was generated
#define STATIC_LOG ( priority,
routine,
text   )     Logging::Logger::getStaticLogger()->log(priority, text, __FILE__, __LINE__, routine);

Used to send logs from a static context (such as from static methods). This macro is primarily useful because it automatically determines the file name and line number for the developer.

Parameters:
priority Logging::BaseLog::Priority of the log message
routine Name of the routine in which this macro is being used from (std::string)
text Log message (std::string)
#define STATIC_LOG_RECORD ( logPriority,
logMessage,
logFile,
logLine,
logRoutine,
logTime   ) 
Value:
{ \
    Logging::BaseLog::LogRecord lr; \
    lr.priority  = logPriority; \
    lr.message   = logMessage; \
    lr.file      = logFile; \
    lr.line      = logLine; \
    lr.method    = logRoutine; \
    lr.timeStamp = logTime; \
    Logging::Logger::getStaticLogger()->log(lr); \
}

Used to publish a log record from a static context. Useful for doing things like setting a specific time the log was sent (rather than letting ACS figure this out for you).

Parameters:
logPriority ACS priority of the log.
logMessage Log message (string).
logFile Name of the file the log was published from (__FILE__)
logLine Line number from where the log was published (__LINE__)
logRoutine Name of the routine from where the log was published (string)
logTime Time the log was published (ACS::Time)

Generated by  doxygen 1.6.2