Defines

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 LM_DELOUSE   010000
#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 STATIC_LOG_TO_AUDIENCE(priority, routine, text, logAudience)
#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 LOG_TO_DEVELOPER(logPriority, logMessage)   LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::DEVELOPER);
#define STATIC_LOG_TO_DEVELOPER(logPriority, logMessage)   STATIC_LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::DEVELOPER);
#define LOG_TO_OPERATOR(logPriority, logMessage)   LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::OPERATOR);
#define STATIC_LOG_TO_OPERATOR(logPriority, logMessage)   STATIC_LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::OPERATOR);
#define LOG_TO_SCIENCE(logPriority, logMessage)   LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::SCILOG);
#define STATIC_LOG_TO_SCIENCE(logPriority, logMessage)   STATIC_LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::SCILOG);
#define LOG_TO_SCILOG(logPriority, logMessage)   LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::SCILOG);
#define STATIC_LOG_TO_SCILOG(logPriority, logMessage)   STATIC_LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::SCILOG);
#define LOG_TO_AUDIENCE_WITH_LOGGER(logPriority, logMessage, logAudience, logger)
#define LOG_TO_OPERATOR_WITH_LOGGER(logPriority, logMessage, logger)   LOG_TO_AUDIENCE_WITH_LOGGER(logPriority, logMessage, log_audience::OPERATOR, logger);
#define LOG_TO_DEVELOPER_WITH_LOGGER(logPriority, logMessage, logger)   LOG_TO_AUDIENCE_WITH_LOGGER(logPriority, logMessage, log_audience::DEVELOPER, logger);

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 LM_DELOUSE   010000
#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 ACE_Log_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 Logging::BaseLog::Priority (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 Logging::BaseLog::Priority (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 ACE_Log_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_TO_AUDIENCE_WITH_LOGGER (   logPriority,
  logMessage,
  logAudience,
  logger 
)
Value:
if (logger != 0) { \
    Logging::BaseLog::LogRecord lr; \
    lr.priority  = Logging::ace2acsPriority(logPriority); \
    lr.message   = logMessage; \
    lr.file      = __FILE__; \
    lr.line      = __LINE__; \
    lr.method    = __PRETTY_FUNCTION__; \
    lr.timeStamp = ::getTimeStamp();     \
    LoggingProxy::audience(logAudience); \
    LoggingProxy::Flags(LM_SOURCE_INFO | LM_RUNTIME_CONTEXT); \
    logger->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 ACE_Log_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
logger The logger to use (Logging::Logger::LoggerSmartPtr)
#define LOG_TO_DEVELOPER (   logPriority,
  logMessage 
)    LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::DEVELOPER);

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

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
#define LOG_TO_DEVELOPER_WITH_LOGGER (   logPriority,
  logMessage,
  logger 
)    LOG_TO_AUDIENCE_WITH_LOGGER(logPriority, logMessage, log_audience::DEVELOPER, logger);

Used to send logs to the developer. This macro is primarily useful because it automatically determines the file name, line number, function name and set the audience to the developer. This can be used in static functions.

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
logger The logger to use (Logging::Logger::LoggerSmartPtr)
#define LOG_TO_OPERATOR (   logPriority,
  logMessage 
)    LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::OPERATOR);

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

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
#define LOG_TO_OPERATOR_WITH_LOGGER (   logPriority,
  logMessage,
  logger 
)    LOG_TO_AUDIENCE_WITH_LOGGER(logPriority, logMessage, log_audience::OPERATOR, logger);

Used to send logs to the operator. This macro is primarily useful because it automatically determines the file name, line number, function name and set the audience to the operator. This can be used in static functions.

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
logger The logger to use (Logging::Logger::LoggerSmartPtr)
#define LOG_TO_SCIENCE (   logPriority,
  logMessage 
)    LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::SCILOG);

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

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
#define LOG_TO_SCILOG (   logPriority,
  logMessage 
)    LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::SCILOG);

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

Note: Replaced by LOG_TO_SCIENCE. This macro will be removed after the ALMA 7.1 release.

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
#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 ACE_Log_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 Logging::BaseLog::Priority (ACS) priority of the log.
logMessage Log message (std::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 STATIC_LOG_TO_AUDIENCE (   priority,
  routine,
  text,
  logAudience 
)
Value:

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

Parameters:
logPriority ACE_Log_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 STATIC_LOG_TO_DEVELOPER (   logPriority,
  logMessage 
)    STATIC_LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::DEVELOPER);

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

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
#define STATIC_LOG_TO_OPERATOR (   logPriority,
  logMessage 
)    STATIC_LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::OPERATOR);

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

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
#define STATIC_LOG_TO_SCIENCE (   logPriority,
  logMessage 
)    STATIC_LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::SCILOG);

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

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)
#define STATIC_LOG_TO_SCILOG (   logPriority,
  logMessage 
)    STATIC_LOG_TO_AUDIENCE(logPriority, __PRETTY_FUNCTION__, logMessage, log_audience::SCILOG);

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

Note: Replaced by LOG_TO_SCIENCE. This macro will be removed after the ALMA 7.1 release.

Parameters:
logPriority ACE_Log_Priority of the log message
logMessage Log message (std::string)