Bayeux  3.4.1
Core Foundation library for SuperNEMO
Macros
logger_macros.h File Reference

Macros associated to logging utilities. More...

#include <sstream>
#include <iostream>
#include <boost/current_function.hpp>
#include <datatools/logger.h>

Go to the source code of this file.

Macros

#define DT_LOG_FATAL(Priority, Message)
 
#define DT_LOG_CRITICAL(Priority, Message)
 
#define DT_LOG_ERROR(Priority, Message)
 
#define DT_LOG_WARNING(Priority, Message)
 
#define DT_LOG_NOTICE(Priority, Message)
 
#define DT_LOG_INFORMATION(Priority, Message)
 
#define DT_LOG_DEBUG(Priority, Message)
 Log Message if Priority is greater or equal to PRIO_DEBUG. More...
 
#define DT_LOG_INFORMATION_SHORT(Priority, Message)
 
#define DT_LOG_NOTICE_SHORT(Priority, Message)
 
#define DT_LOG_DEBUG_SHORT(Priority, Message)
 
#define DT_LOG_TRACE(Priority, Message)
 Log Message if Priority is greater or equal to PRIO_TRACE. More...
 
#define DT_LOG_TRACE_SHORT(Priority, Message)
 
#define DT_LOG_TRACE_ENTERING(Priority)
 Log a fonction entering message if Priority is greater or equal to PRIO_TRACE. More...
 
#define DT_LOG_TRACE_EXITING(Priority)
 Log a fonction exiting message if Priority is greater or equal to PRIO_TRACE. More...
 

Detailed Description

Macros associated to logging utilities.

Macro Definition Documentation

◆ DT_LOG_CRITICAL

#define DT_LOG_CRITICAL (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_CRITICAL) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[critical:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \
std::cerr << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Always print the message.
Definition: logger.h:83
A critical error. The application might not be able to continue running successfully.
Definition: logger.h:86

Log Message if Priority is greater or equal to PRIO_CRITICAL

Example:

...
DT_LOG_CRITICAL(loglevel, "Possible mismatch with address '" << strange_address << "'!");

◆ DT_LOG_DEBUG

#define DT_LOG_DEBUG (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_DEBUG) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[debug:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \
std::cerr << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Always print the message.
Definition: logger.h:83
A debugging message.
Definition: logger.h:91

Log Message if Priority is greater or equal to PRIO_DEBUG.

◆ DT_LOG_DEBUG_SHORT

#define DT_LOG_DEBUG_SHORT (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_DEBUG) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[debug] " << Message << std::endl; \
std::cerr << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Always print the message.
Definition: logger.h:83
A debugging message.
Definition: logger.h:91

Log Message if Priority is greater or equal to PRIO_DEBUG (short format)

Log message short format is expected to be used after a call to the normal DT_LOG_DEBUG macro. Example:

...
DT_LOG_DEBUG(loglevel, "List of items:");
for (const auto & item : items) {
DT_LOG_DEBUG_SHORT(loglevel, "Item = " << item);
}

◆ DT_LOG_ERROR

#define DT_LOG_ERROR (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_ERROR) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[error:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \
std::cerr << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
An error. An operation did not complete successfully, but the application as a whole is not affected.
Definition: logger.h:87
Always print the message.
Definition: logger.h:83

Log Message if Priority is greater or equal to PRIO_ERROR

Example:

...
DT_LOG_ERROR(loglevel, "Parsing failed at line #" << line_no << "!");

◆ DT_LOG_FATAL

#define DT_LOG_FATAL (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_FATAL) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[fatal:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \
std::cerr << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
A fatal error. The application will most likely terminate. This is the highest priority.
Definition: logger.h:85
Always print the message.
Definition: logger.h:83

Log Message if Priority is greater or equal to PRIO_FATAL

Example:

...
DT_LOG_FATAL(loglevel, "Invalid indentifier '" << bad_id << "'!");

◆ DT_LOG_INFORMATION

#define DT_LOG_INFORMATION (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_INFORMATION) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[information:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \
std::clog << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
An informational message, usually denoting the successful completion of an operation.
Definition: logger.h:90
Always print the message.
Definition: logger.h:83

Log Message if Priority is greater or equal to PRIO_INFORMATION

Example:

...
DT_LOG_INFORMATION(loglevel, "Processing event #" << event_id << "...");

◆ DT_LOG_INFORMATION_SHORT

#define DT_LOG_INFORMATION_SHORT (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_INFORMATION) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[debug] " << Message << std::endl; \
std::clog << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
An informational message, usually denoting the successful completion of an operation.
Definition: logger.h:90
Always print the message.
Definition: logger.h:83

Log Message if Priority is greater or equal to PRIO_INFORMATION (short format)

Log message short format is expected to be used after a call to the normal DT_LOG_INFORMATION macro. Example:

...
DT_LOG_INFORMATION(loglevel, "List of items:");
for (const auto & item : items) {
DT_LOG_INFORMATION_SHORT(loglevel, "Item = " << item);
}

◆ DT_LOG_NOTICE

#define DT_LOG_NOTICE (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_NOTICE) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[notice:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \
std::clog << _dt_xxx_out.str(); \
} \
}
A notice, which is an information with just a higher priority.
Definition: logger.h:89
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Always print the message.
Definition: logger.h:83

Log Message if Priority is greater or equal to PRIO_NOTICE

Example:

...
DT_LOG_NOTICE(loglevel, "Starting server...");

◆ DT_LOG_NOTICE_SHORT

#define DT_LOG_NOTICE_SHORT (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_NOTICE) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[debug] " << Message << std::endl; \
std::clog << _dt_xxx_out.str(); \
} \
}
A notice, which is an information with just a higher priority.
Definition: logger.h:89
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Always print the message.
Definition: logger.h:83

Log Message if Priority is greater or equal to PRIO_NOTICE (short format)

Log message short format is expected to be used after a call to the normal DT_LOG_NOTICE macro. Example:

...
DT_LOG_NOTICE(loglevel, "List of items:");
for (const auto & item : items) {
DT_LOG_NOTICE_SHORT(loglevel, "Item = " << item);
}

◆ DT_LOG_TRACE

#define DT_LOG_TRACE (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_TRACE) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[trace:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \
std::cerr << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Always print the message.
Definition: logger.h:83
A tracing message. This is the lowest priority.
Definition: logger.h:92

Log Message if Priority is greater or equal to PRIO_TRACE.

◆ DT_LOG_TRACE_ENTERING

#define DT_LOG_TRACE_ENTERING (   Priority)
Value:
{ \
DT_LOG_TRACE(Priority, "Entering..."); \
}

Log a fonction entering message if Priority is greater or equal to PRIO_TRACE.

◆ DT_LOG_TRACE_EXITING

#define DT_LOG_TRACE_EXITING (   Priority)
Value:
{ \
DT_LOG_TRACE(Priority, "Exiting."); \
}

Log a fonction exiting message if Priority is greater or equal to PRIO_TRACE.

◆ DT_LOG_TRACE_SHORT

#define DT_LOG_TRACE_SHORT (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_TRACE) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[trace] " << Message << std::endl; \
std::clog << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Always print the message.
Definition: logger.h:83
A tracing message. This is the lowest priority.
Definition: logger.h:92

Log Message if Priority is greater or equal to PRIO_TRACE (short format)

Log message short format is expected to be used after a call to the normal DT_LOG_TRACE macro. Example:

...
DT_LOG_TRACE(loglevel, "Devel details:");
for (const auto & detail : details) {
DT_LOG_TRACE_SHORT(loglevel, "Devel detail: " << detail);
}

◆ DT_LOG_WARNING

#define DT_LOG_WARNING (   Priority,
  Message 
)
Value:
{ \
::datatools::logger::priority _dt_xxx_p = Priority; \
if (_dt_xxx_p == ::datatools::logger::PRIO_ALWAYS || _dt_xxx_p >= ::datatools::logger::PRIO_WARNING) { \
std::ostringstream _dt_xxx_out; \
_dt_xxx_out << "[warning:" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << "] " << Message << std::endl; \
std::cerr << _dt_xxx_out.str(); \
} \
}
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Always print the message.
Definition: logger.h:83
A warning. An operation completed with an unexpected result.
Definition: logger.h:88

Log Message if Priority is greater or equal to PRIO_WARNING

Example:

...
DT_LOG_WARNING(loglevel, "GUI is not available in this context! Falling back to command line interface!");