Myra Canyon  v0.0.1-768
network control
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Logging.hpp File Reference

Debug logging. More...

#include <string>
#include <exception>
#include <boost/log/trivial.hpp>
Include dependency graph for Logging.hpp:
This graph shows which files directly or indirectly include this file:

Namespaces

 Myra
 Namespace declaration for all of the Myra Canyon helper functions.
 

Macros

#define LOG_HIGHLIGHT
 Log a line so it stands out when it happens. Sometimes useful for temporary debugging. More...
 
#define LOG_PROBLEM(error_no, msg)
 Log a serious problem. Include the backtrace, and errno if it is non-zero. More...
 
#define THROW_RUNTIME_ERROR(error_no, msg)
 Log an error and throw a std::runtime_error object. More...
 
#define THROW_INVALID_ARGUMENT(error_no, msg)
 Log an error and throw a std::invalid_argument object. More...
 
#define LOG_TRACE   BOOST_LOG_TRIVIAL(trace)
 All logging should be done using one of the LOG macros. More...
 
#define LOG_DEBUG   BOOST_LOG_TRIVIAL(debug)
 All logging should be done using one of the LOG macros. More...
 
#define LOG_INFO   BOOST_LOG_TRIVIAL(info)
 All logging should be done using one of the LOG macros. More...
 
#define LOG_WARN   BOOST_LOG_TRIVIAL(warning)
 All logging should be done using one of the LOG macros. More...
 
#define LOG_ERROR   BOOST_LOG_TRIVIAL(error)
 All logging should be done using one of the LOG macros. More...
 
#define LOG_FATAL   BOOST_LOG_TRIVIAL(fatal)
 All logging should be done using one of the LOG macros. More...
 

Functions

void Myra::initialize_logging (void)
 Initialize boost::log. More...
 
void Myra::initialize_file_logging (const std::string &filename)
 Add the specified filename as a log sink. More...
 
void Myra::reset_logging (void)
 Reset boost::log and disable logging. More...
 
void Myra::log_backtrace (void)
 Log a line for every function name in the call stack. More...
 

Detailed Description

Debug logging.

Uses BOOST_LOG_TRIVIAL.

Macro Definition Documentation

#define LOG_DEBUG   BOOST_LOG_TRIVIAL(debug)

All logging should be done using one of the LOG macros.

#define LOG_ERROR   BOOST_LOG_TRIVIAL(error)

All logging should be done using one of the LOG macros.

#define LOG_FATAL   BOOST_LOG_TRIVIAL(fatal)

All logging should be done using one of the LOG macros.

#define LOG_HIGHLIGHT
Value:
LOG_ERROR << "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; \
#define LOG_ERROR
All logging should be done using one of the LOG macros.
Definition: Logging.hpp:38

Log a line so it stands out when it happens. Sometimes useful for temporary debugging.

#define LOG_INFO   BOOST_LOG_TRIVIAL(info)

All logging should be done using one of the LOG macros.

#define LOG_PROBLEM (   error_no,
  msg 
)
Value:
if (error_no) LOG_ERROR << "Problem in " << __PRETTY_FUNCTION__ \
<< ": errno " << error_no \
<< ": " << strerror(error_no); \
else LOG_ERROR << "Problem in " << __PRETTY_FUNCTION__ << ":"; \
LOG_ERROR << "ERROR! " << msg;
#define LOG_ERROR
All logging should be done using one of the LOG macros.
Definition: Logging.hpp:38
void log_backtrace(void)
Log a line for every function name in the call stack.
Definition: Logging.cpp:90
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: jsoncpp.cpp:233

Log a serious problem. Include the backtrace, and errno if it is non-zero.

#define LOG_TRACE   BOOST_LOG_TRIVIAL(trace)

All logging should be done using one of the LOG macros.

#define LOG_WARN   BOOST_LOG_TRIVIAL(warning)

All logging should be done using one of the LOG macros.

#define THROW_INVALID_ARGUMENT (   error_no,
  msg 
)
Value:
LOG_PROBLEM(error_no, msg) \
LOG_ERROR << "ERROR! Throwing std::invalid_argument due to previous error."; \
throw std::invalid_argument(msg);
#define LOG_ERROR
All logging should be done using one of the LOG macros.
Definition: Logging.hpp:38
#define LOG_PROBLEM(error_no, msg)
Log a serious problem. Include the backtrace, and errno if it is non-zero.
Definition: Logging.hpp:48

Log an error and throw a std::invalid_argument object.

#define THROW_RUNTIME_ERROR (   error_no,
  msg 
)
Value:
LOG_PROBLEM(error_no, msg) \
LOG_ERROR << "ERROR! Throwing std::runtime_error due to previous error."; \
throw std::runtime_error(msg);
#define LOG_ERROR
All logging should be done using one of the LOG macros.
Definition: Logging.hpp:38
#define LOG_PROBLEM(error_no, msg)
Log a serious problem. Include the backtrace, and errno if it is non-zero.
Definition: Logging.hpp:48

Log an error and throw a std::runtime_error object.