Commit 0a25eb73 authored by Dominik Charousset's avatar Dominik Charousset

Print errors even when compiling without logging

parent f2eb92d8
...@@ -191,19 +191,24 @@ private: ...@@ -191,19 +191,24 @@ private:
#define CAF_UNIFYN(NAME) CAF_CONCAT(NAME, __LINE__) #define CAF_UNIFYN(NAME) CAF_CONCAT(NAME, __LINE__)
#define CAF_PRINT_ERROR_IMPL(nclass, nfun, message) \ #define CAF_PRINT_ERROR_IMPL(nclass, nfun, message) \
{ \ do { \
caf::logger::line_builder lb; \ caf::logger::line_builder lb; \
lb << message; \ lb << message; \
if (nclass.empty()) \ if (nclass.empty()) \
printf("[ERROR] %s::%s: %s\n", nclass.c_str(), nfun, lb.get().c_str()); \ printf("[ERROR] %s::%s: %s\n", nclass.c_str(), nfun, lb.get().c_str()); \
else \ else \
printf("[ERROR] %s: %s\n", nfun, lb.get().c_str()); \ printf("[ERROR] %s: %s\n", nfun, lb.get().c_str()); \
} \ } while (false)
CAF_VOID_STMT
#ifndef CAF_LOG_LEVEL #define CAF_ARG(argument) caf::logger::make_arg_wrapper(#argument, argument)
#define CAF_ARG(unused) #ifdef CAF_MSVC
#define CAF_GET_CLASS_NAME caf::logger::extract_class_name(__FUNCSIG__)
#else // CAF_MSVC
#define CAF_GET_CLASS_NAME caf::logger::extract_class_name(__PRETTY_FUNCTION__)
#endif // CAF_MSVC
#ifndef CAF_LOG_LEVEL
#define CAF_LOG_IMPL(unused1, unused2) #define CAF_LOG_IMPL(unused1, unused2)
...@@ -222,18 +227,7 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; } ...@@ -222,18 +227,7 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
#else // CAF_LOG_LEVEL #else // CAF_LOG_LEVEL
#define CAF_ARG(argument) caf::logger::make_arg_wrapper(#argument, argument)
#ifdef CAF_MSVC
#define CAF_GET_CLASS_NAME caf::logger::extract_class_name(__FUNCSIG__)
#else // CAF_MSVC
#define CAF_GET_CLASS_NAME caf::logger::extract_class_name(__PRETTY_FUNCTION__)
#endif // CAF_MSVC
#define CAF_LOG_IMPL(loglvl, message) \ #define CAF_LOG_IMPL(loglvl, message) \
if (loglvl == 0) { \
CAF_PRINT_ERROR_IMPL(CAF_GET_CLASS_NAME, __func__, message); \
} \
caf::logger::log_static(loglvl, CAF_GET_CLASS_NAME, __func__, \ caf::logger::log_static(loglvl, CAF_GET_CLASS_NAME, __func__, \
__FILE__, __LINE__, \ __FILE__, __LINE__, \
(caf::logger::line_builder{} << message).get()) (caf::logger::line_builder{} << message).get())
...@@ -282,7 +276,11 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; } ...@@ -282,7 +276,11 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
#define CAF_LOG_DEBUG(output) CAF_LOG_IMPL(CAF_LOG_LEVEL_DEBUG, output) #define CAF_LOG_DEBUG(output) CAF_LOG_IMPL(CAF_LOG_LEVEL_DEBUG, output)
#define CAF_LOG_INFO(output) CAF_LOG_IMPL(CAF_LOG_LEVEL_INFO, output) #define CAF_LOG_INFO(output) CAF_LOG_IMPL(CAF_LOG_LEVEL_INFO, output)
#define CAF_LOG_WARNING(output) CAF_LOG_IMPL(CAF_LOG_LEVEL_WARNING, output) #define CAF_LOG_WARNING(output) CAF_LOG_IMPL(CAF_LOG_LEVEL_WARNING, output)
#define CAF_LOG_ERROR(output) CAF_LOG_IMPL(CAF_LOG_LEVEL_ERROR, output) #define CAF_LOG_ERROR(output) \
do { \
CAF_PRINT_ERROR_IMPL(CAF_GET_CLASS_NAME, __func__, output); \
CAF_LOG_IMPL(CAF_LOG_LEVEL_ERROR, output); \
} while (false)
#ifdef CAF_LOG_LEVEL #ifdef CAF_LOG_LEVEL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment