Dragon - C++ API
A Computation Graph Virtual Machine Based Deep Learning Framework
Classes | Namespaces | Macros | Enumerations | Functions
logging.h File Reference
#include <iostream>
#include <sstream>

Go to the source code of this file.

Classes

class  dragon::MessageLogger
 

Namespaces

 dragon
 

Macros

#define FATAL_IF(condition)   condition ? MessageLogger("-1", -1, -1).stream() : MessageLogger(__FILE__, __LINE__, FATAL).stream()
 
#define CHECK(condition)   FATAL_IF(condition) << "Check failed: "#condition" "
 
#define CHECK_OP(val1, val2, op)   FATAL_IF(val1 op val2) << "Check failed: " #val1 " " #op " " #val2 " " << "(" << val1 <<" vs "<<val2 <<")"
 
#define CHECK_EQ(val1, val2)   CHECK_OP(val1, val2, ==)
 
#define CHECK_NE(val1, val2)   CHECK_OP(val1, val2, !=)
 
#define CHECK_GT(val1, val2)   CHECK_OP(val1, val2, >)
 
#define CHECK_GE(val1, val2)   CHECK_OP(val1, val2, >=)
 
#define CHECK_LT(val1, val2)   CHECK_OP(val1, val2, <)
 
#define CHECK_LE(val1, val2)   CHECK_OP(val1, val2, <=)
 
#define LOG(severity)   MessageLogger(__FILE__, __LINE__, severity).stream()
 
#define LOG_IF(severity, condition)   if(condition) MessageLogger(__FILE__, __LINE__, severity).stream()
 
#define LOG_EVERY_N(severity, n)   MessageLogger(__FILE__, __LINE__, EveryNRegister(__FILE__, __LINE__, severity, n)).stream()
 

Enumerations

enum  dragon::LogSeverity {
  dragon::DEBUG, dragon::INFO, dragon::WARNING, dragon::ERROR,
  dragon::FATAL
}
 

Functions

LogSeverity dragon::StrToLogSeverity (std::string level)
 
std::string dragon::SeverityToStr (LogSeverity severity)
 
void dragon::SetLogDestination (LogSeverity type)
 
int dragon::EveryNRegister (const char *file, int line, int severity, int n)
 

Macro Definition Documentation

◆ CHECK

#define CHECK (   condition)    FATAL_IF(condition) << "Check failed: "#condition" "

◆ CHECK_EQ

#define CHECK_EQ (   val1,
  val2 
)    CHECK_OP(val1, val2, ==)

◆ CHECK_GE

#define CHECK_GE (   val1,
  val2 
)    CHECK_OP(val1, val2, >=)

◆ CHECK_GT

#define CHECK_GT (   val1,
  val2 
)    CHECK_OP(val1, val2, >)

◆ CHECK_LE

#define CHECK_LE (   val1,
  val2 
)    CHECK_OP(val1, val2, <=)

◆ CHECK_LT

#define CHECK_LT (   val1,
  val2 
)    CHECK_OP(val1, val2, <)

◆ CHECK_NE

#define CHECK_NE (   val1,
  val2 
)    CHECK_OP(val1, val2, !=)

◆ CHECK_OP

#define CHECK_OP (   val1,
  val2,
  op 
)    FATAL_IF(val1 op val2) << "Check failed: " #val1 " " #op " " #val2 " " << "(" << val1 <<" vs "<<val2 <<")"

◆ FATAL_IF

#define FATAL_IF (   condition)    condition ? MessageLogger("-1", -1, -1).stream() : MessageLogger(__FILE__, __LINE__, FATAL).stream()

◆ LOG

#define LOG (   severity)    MessageLogger(__FILE__, __LINE__, severity).stream()

◆ LOG_EVERY_N

#define LOG_EVERY_N (   severity,
 
)    MessageLogger(__FILE__, __LINE__, EveryNRegister(__FILE__, __LINE__, severity, n)).stream()

◆ LOG_IF

#define LOG_IF (   severity,
  condition 
)    if(condition) MessageLogger(__FILE__, __LINE__, severity).stream()