Commit a4e262dc authored by Marian Triebe's avatar Marian Triebe

Fix compile with log level trace

parent 5658d0e7
...@@ -204,7 +204,7 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; } ...@@ -204,7 +204,7 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
#define CAF_PRINT4(arg0, arg1, arg2, arg3) #define CAF_PRINT4(arg0, arg1, arg2, arg3)
#else #else
#define CAF_PRINT4(lvlname, classname, funname, msg) \ #define CAF_PRINT4(lvlname, classname, funname, msg) \
caf::detail::logging::trace_helper caf_trace_helper_ { \ caf::detail::logging::trace_helper { \
classname, funname, __FILE__, __LINE__, \ classname, funname, __FILE__, __LINE__, \
(caf::detail::oss_wr{} << msg).str() \ (caf::detail::oss_wr{} << msg).str() \
} }
......
...@@ -160,12 +160,12 @@ class invoke_policy { ...@@ -160,12 +160,12 @@ class invoke_policy {
template <class Actor, class Fun, class MaybeResponseHdl = int> template <class Actor, class Fun, class MaybeResponseHdl = int>
optional<message> invoke_fun(Actor* self, Fun& fun, optional<message> invoke_fun(Actor* self, Fun& fun,
MaybeResponseHdl hdl = MaybeResponseHdl{}) { MaybeResponseHdl hdl = MaybeResponseHdl{}) {
# ifdef CAF_LOG_LEVEL
auto msg_str = to_string(msg);
# endif
CAF_LOG_TRACE(CAF_MARG(mid, integer_value) << ", msg = " << msg_str);
auto mid = self->current_mailbox_element()->mid; auto mid = self->current_mailbox_element()->mid;
auto res = fun(self->current_mailbox_element()->msg); auto res = fun(self->current_mailbox_element()->msg);
# ifdef CAF_LOG_LEVEL
auto msg_str = res ? to_string(*res) : "none";
# endif
CAF_LOG_TRACE(CAF_MARG(mid, integer_value) << "m, msg = " << msg_str);
CAF_LOG_DEBUG_IF(res, "actor did consume message: " << msg_str); CAF_LOG_DEBUG_IF(res, "actor did consume message: " << msg_str);
CAF_LOG_DEBUG_IF(!res, "actor did ignore message: " << msg_str); CAF_LOG_DEBUG_IF(!res, "actor did ignore message: " << msg_str);
if (!res) { if (!res) {
......
...@@ -230,7 +230,7 @@ void abstract_actor::cleanup(uint32_t reason) { ...@@ -230,7 +230,7 @@ void abstract_actor::cleanup(uint32_t reason) {
CAF_LOG_INFO_IF(!is_remote(), "cleanup actor with ID " CAF_LOG_INFO_IF(!is_remote(), "cleanup actor with ID "
<< m_id << "; exit reason = " << m_id << "; exit reason = "
<< reason << ", class = " << reason << ", class = "
<< class_name()); << CAF_CLASS_NAME);
// send exit messages // send exit messages
for (attachable* i = head.get(); i != nullptr; i = i->next.get()) { for (attachable* i = head.get(); i != nullptr; i = i->next.get()) {
i->actor_exited(this, reason); i->actor_exited(this, reason);
......
...@@ -164,7 +164,7 @@ void local_actor::cleanup(uint32_t reason) { ...@@ -164,7 +164,7 @@ void local_actor::cleanup(uint32_t reason) {
void local_actor::quit(uint32_t reason) { void local_actor::quit(uint32_t reason) {
CAF_LOG_TRACE("reason = " << reason << ", class = " CAF_LOG_TRACE("reason = " << reason << ", class = "
<< class_name()); << CAF_CLASS_NAME);
planned_exit_reason(reason); planned_exit_reason(reason);
if (is_blocking()) { if (is_blocking()) {
throw actor_exited(reason); throw actor_exited(reason);
......
...@@ -156,7 +156,7 @@ policy::invoke_message_result broker::invoke_message(mailbox_element_ptr& msg, ...@@ -156,7 +156,7 @@ policy::invoke_message_result broker::invoke_message(mailbox_element_ptr& msg,
} }
void broker::invoke_message(mailbox_element_ptr& ptr) { void broker::invoke_message(mailbox_element_ptr& ptr) {
CAF_LOG_TRACE(CAF_TARG(msg, to_string)); CAF_LOG_TRACE(CAF_TARG(ptr->msg, to_string));
if (exit_reason() != exit_reason::not_exited || bhvr_stack().empty()) { if (exit_reason() != exit_reason::not_exited || bhvr_stack().empty()) {
CAF_LOG_DEBUG("actor already finished execution" CAF_LOG_DEBUG("actor already finished execution"
<< ", planned_exit_reason = " << planned_exit_reason() << ", planned_exit_reason = " << planned_exit_reason()
......
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