carl  24.04
Computer ARithmetic Library
logging.h File Reference
#include "LogLevel.h"
#include <sstream>
#include <string>
Include dependency graph for logging.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  carl::logging::RecordInfo
 Additional information about a log message. More...
 

Namespaces

 carl
 carl is the main namespace for the library.
 
 carl::logging
 Contains a custom logging facility.
 

Macros

#define __CARL_LOG_RECORD   ::carl::logging::RecordInfo{__FILE__, __func__, __LINE__}
 Create a record info. More...
 
#define __CARL_LOG_RECORD_NOFUNC   ::carl::logging::RecordInfo{__FILE__, "", __LINE__}
 Create a record info without function name. More...
 
#define __CARL_LOG(level, channel, expr)
 Basic logging macro. More...
 
#define __CARL_LOG_NOFUNC(level, channel, expr)
 Basic logging macro without function name. More...
 
#define __CARL_LOG_FUNC(channel, args)   __CARL_LOG_NOFUNC(::carl::logging::LogLevel::LVL_TRACE, channel, __func__ << "(" << args << ")");
 Intended to be called when entering a function. Format: <function name>(<args>). More...
 
#define __CARL_LOG_TRACE(channel, expr)   __CARL_LOG(::carl::logging::LogLevel::LVL_TRACE, channel, expr)
 Log with level LVL_TRACE. More...
 
#define __CARL_LOG_DEBUG(channel, expr)   __CARL_LOG(::carl::logging::LogLevel::LVL_DEBUG, channel, expr)
 Log with level LVL_DEBUG. More...
 
#define __CARL_LOG_INFO(channel, expr)   __CARL_LOG(::carl::logging::LogLevel::LVL_INFO, channel, expr)
 Log with level LVL_INFO. More...
 
#define __CARL_LOG_WARN(channel, expr)   __CARL_LOG(::carl::logging::LogLevel::LVL_WARN, channel, expr)
 Log with level LVL_WARN. More...
 
#define __CARL_LOG_ERROR(channel, expr)   __CARL_LOG(::carl::logging::LogLevel::LVL_ERROR, channel, expr)
 Log with level LVL_ERROR. More...
 
#define __CARL_LOG_FATAL(channel, expr)   __CARL_LOG(::carl::logging::LogLevel::LVL_FATAL, channel, expr)
 Log with level LVL_FATAL. More...
 
#define __CARL_LOG_ASSERT(channel, condition, expr)   if (!(condition)) { __CARL_LOG_FATAL(channel, expr); assert(condition); }
 Log and assert the given condition, if the condition evaluates to false. More...
 

Functions

bool carl::logging::visible (LogLevel level, const std::string &channel) noexcept
 
void carl::logging::log (LogLevel level, const std::string &channel, const std::stringstream &ss, const RecordInfo &info)
 

Macro Definition Documentation

◆ __CARL_LOG

#define __CARL_LOG (   level,
  channel,
  expr 
)
Value:
{ \
if (::carl::logging::visible(level, channel)) { \
std::stringstream __ss; __ss << expr; ::carl::logging::log(level, channel, __ss, __CARL_LOG_RECORD); \
}}
#define __CARL_LOG_RECORD
Create a record info.
Definition: logging.h:32
Interval< Number > log(const Interval< Number > &i)
Definition: Exponential.h:22
bool visible(LogLevel level, const std::string &channel) noexcept
Definition: logging.cpp:7

Basic logging macro.

Definition at line 36 of file logging.h.

◆ __CARL_LOG_ASSERT

#define __CARL_LOG_ASSERT (   channel,
  condition,
  expr 
)    if (!(condition)) { __CARL_LOG_FATAL(channel, expr); assert(condition); }

Log and assert the given condition, if the condition evaluates to false.

Definition at line 64 of file logging.h.

◆ __CARL_LOG_DEBUG

#define __CARL_LOG_DEBUG (   channel,
  expr 
)    __CARL_LOG(::carl::logging::LogLevel::LVL_DEBUG, channel, expr)

Log with level LVL_DEBUG.

Definition at line 53 of file logging.h.

◆ __CARL_LOG_ERROR

#define __CARL_LOG_ERROR (   channel,
  expr 
)    __CARL_LOG(::carl::logging::LogLevel::LVL_ERROR, channel, expr)

Log with level LVL_ERROR.

Definition at line 59 of file logging.h.

◆ __CARL_LOG_FATAL

#define __CARL_LOG_FATAL (   channel,
  expr 
)    __CARL_LOG(::carl::logging::LogLevel::LVL_FATAL, channel, expr)

Log with level LVL_FATAL.

Definition at line 61 of file logging.h.

◆ __CARL_LOG_FUNC

#define __CARL_LOG_FUNC (   channel,
  args 
)    __CARL_LOG_NOFUNC(::carl::logging::LogLevel::LVL_TRACE, channel, __func__ << "(" << args << ")");

Intended to be called when entering a function. Format: <function name>(<args>).

Definition at line 48 of file logging.h.

◆ __CARL_LOG_INFO

#define __CARL_LOG_INFO (   channel,
  expr 
)    __CARL_LOG(::carl::logging::LogLevel::LVL_INFO, channel, expr)

Log with level LVL_INFO.

Definition at line 55 of file logging.h.

◆ __CARL_LOG_NOFUNC

#define __CARL_LOG_NOFUNC (   level,
  channel,
  expr 
)
Value:
{ \
if (::carl::logging::visible(level, channel)) { \
std::stringstream __ss; __ss << expr; ::carl::logging::log(level, channel, __ss, __CARL_LOG_RECORD_NOFUNC); \
}}
#define __CARL_LOG_RECORD_NOFUNC
Create a record info without function name.
Definition: logging.h:34

Basic logging macro without function name.

Definition at line 42 of file logging.h.

◆ __CARL_LOG_RECORD

#define __CARL_LOG_RECORD   ::carl::logging::RecordInfo{__FILE__, __func__, __LINE__}

Create a record info.

Definition at line 32 of file logging.h.

◆ __CARL_LOG_RECORD_NOFUNC

#define __CARL_LOG_RECORD_NOFUNC   ::carl::logging::RecordInfo{__FILE__, "", __LINE__}

Create a record info without function name.

Definition at line 34 of file logging.h.

◆ __CARL_LOG_TRACE

#define __CARL_LOG_TRACE (   channel,
  expr 
)    __CARL_LOG(::carl::logging::LogLevel::LVL_TRACE, channel, expr)

Log with level LVL_TRACE.

Definition at line 51 of file logging.h.

◆ __CARL_LOG_WARN

#define __CARL_LOG_WARN (   channel,
  expr 
)    __CARL_LOG(::carl::logging::LogLevel::LVL_WARN, channel, expr)

Log with level LVL_WARN.

Definition at line 57 of file logging.h.