YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
log.hpp File Reference
#include <string_view>
Include dependency graph for log.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  yaclib
 
namespace  yaclib::detail
 

Macros

#define YACLIB_FUNC_NAME   __func__
 
#define YACLIB_LOG_MESSAGE(level, cond, message)
 
#define YACLIB_SET_CALLBACK(level, callback)
 
#define YACLIB_STUB1(first)
 
#define YACLIB_STUB2(first, second)
 
#define YACLIB_INIT_WARN(callback)   YACLIB_STUB1(callback)
 
#define YACLIB_WARN(cond, message)   YACLIB_STUB2(cond, message)
 
#define YACLIB_INIT_DEBUG(callback)   YACLIB_STUB1(callback)
 
#define YACLIB_DEBUG(cond, message)   YACLIB_STUB2(cond, message)
 
#define YACLIB_ASSERT(cond)   YACLIB_STUB1(!(cond))
 
#define YACLIB_PURE_VIRTUAL()   YACLIB_STUB1(true)
 

Typedefs

using yaclib::LogCallback = void(*)(std::string_view file, std::size_t line, std::string_view function, std::string_view condition, std::string_view message) noexcept
 

Enumerations

enum class  yaclib::detail::LogLevel : unsigned char { yaclib::detail::Debug = 0 , yaclib::detail::Warn = 1 , yaclib::detail::Count = 3 }
 

Functions

void yaclib::detail::SetCallback (LogLevel level, LogCallback callback) noexcept
 
void yaclib::detail::LogMessage (LogLevel level, std::string_view file, std::size_t line, std::string_view func, std::string_view condition, std::string_view message) noexcept
 

Macro Definition Documentation

◆ YACLIB_ASSERT

#define YACLIB_ASSERT (   cond)    YACLIB_STUB1(!(cond))

Definition at line 85 of file log.hpp.

◆ YACLIB_DEBUG

#define YACLIB_DEBUG (   cond,
  message 
)    YACLIB_STUB2(cond, message)

Definition at line 84 of file log.hpp.

◆ YACLIB_FUNC_NAME

#define YACLIB_FUNC_NAME   __func__

Definition at line 34 of file log.hpp.

◆ YACLIB_INIT_DEBUG

#define YACLIB_INIT_DEBUG (   callback)    YACLIB_STUB1(callback)

Definition at line 83 of file log.hpp.

◆ YACLIB_INIT_WARN

#define YACLIB_INIT_WARN (   callback)    YACLIB_STUB1(callback)

Definition at line 73 of file log.hpp.

◆ YACLIB_LOG_MESSAGE

#define YACLIB_LOG_MESSAGE (   level,
  cond,
  message 
)
Value:
do { \
if (!!(cond)) { \
::yaclib::detail::LogMessage(level, __FILE__, __LINE__, YACLIB_FUNC_NAME, #cond, (message)); \
} \
} while (false)
#define YACLIB_FUNC_NAME
Definition log.hpp:34

Definition at line 38 of file log.hpp.

◆ YACLIB_PURE_VIRTUAL

#define YACLIB_PURE_VIRTUAL ( )    YACLIB_STUB1(true)

Definition at line 86 of file log.hpp.

◆ YACLIB_SET_CALLBACK

#define YACLIB_SET_CALLBACK (   level,
  callback 
)
Value:
do { \
::yaclib::detail::SetCallback(level, (callback)); \
} while (false)

Definition at line 45 of file log.hpp.

◆ YACLIB_STUB1

#define YACLIB_STUB1 (   first)
Value:
do { \
if (false) { \
(void)(first); \
} \
} while (false)

Definition at line 54 of file log.hpp.

◆ YACLIB_STUB2

#define YACLIB_STUB2 (   first,
  second 
)
Value:
do { \
if (false) { \
(void)(first); \
(void)(second); \
} \
} while (false)

Definition at line 60 of file log.hpp.

◆ YACLIB_WARN

#define YACLIB_WARN (   cond,
  message 
)    YACLIB_STUB2(cond, message)

Definition at line 74 of file log.hpp.