Commit 923e91c3 authored by Dominik Charousset's avatar Dominik Charousset

Log scoped and blocking actors too

parent 5a61e5da
...@@ -169,10 +169,11 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; } ...@@ -169,10 +169,11 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
caf::detail::singletons::get_logger()->log(lvlname, classname, funname, \ caf::detail::singletons::get_logger()->log(lvlname, classname, funname, \
__FILE__, __LINE__, \ __FILE__, __LINE__, \
(caf::detail::oss_wr{} \ (caf::detail::oss_wr{} \
<< std::boolalpha \
<< message).str()) << message).str())
#define CAF_PUSH_AID(aid_arg) \ #define CAF_PUSH_AID(aid_arg) \
auto prev_aid_in_scope = \ auto prev_aid_in_scope \
caf::detail::singletons::get_logger()->set_aid(aid_arg); \ = caf::detail::singletons::get_logger()->set_aid(aid_arg); \
auto aid_pop_sg = caf::detail::make_scope_guard([=] { \ auto aid_pop_sg = caf::detail::make_scope_guard([=] { \
caf::detail::singletons::get_logger()->set_aid(prev_aid_in_scope); \ caf::detail::singletons::get_logger()->set_aid(prev_aid_in_scope); \
}) })
...@@ -296,35 +297,30 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; } ...@@ -296,35 +297,30 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
#define CAF_LOG_INFO_IF(stmt, msg) CAF_LOGMF_IF(stmt, CAF_INFO, msg) #define CAF_LOG_INFO_IF(stmt, msg) CAF_LOGMF_IF(stmt, CAF_INFO, msg)
#define CAF_LOG_TRACE_IF(stmt, msg) CAF_LOGMF_IF(stmt, CAF_TRACE, msg) #define CAF_LOG_TRACE_IF(stmt, msg) CAF_LOGMF_IF(stmt, CAF_TRACE, msg)
#define CAF_LOGC_ERROR(cname, fname, msg) \ #define CAF_LOGC_ERROR(cname, fun, msg) CAF_LOGC(CAF_ERROR, cname, fun, msg)
CAF_LOGC(CAF_ERROR, cname, fname, msg)
#define CAF_LOGC_WARNING(cname, fname, msg) \ #define CAF_LOGC_WARNING(cname, fun, msg) CAF_LOGC(CAF_WARNING, cname, fun, msg)
CAF_LOGC(CAF_WARNING, cname, fname, msg)
#define CAF_LOGC_DEBUG(cname, fname, msg) \ #define CAF_LOGC_DEBUG(cname, fun, msg) CAF_LOGC(CAF_DEBUG, cname, fun, msg)
CAF_LOGC(CAF_DEBUG, cname, fname, msg)
#define CAF_LOGC_INFO(cname, fname, msg) \ #define CAF_LOGC_INFO(cname, fun, msg) CAF_LOGC(CAF_INFO, cname, fun, msg)
CAF_LOGC(CAF_INFO, cname, fname, msg)
#define CAF_LOGC_TRACE(cname, fname, msg) \ #define CAF_LOGC_TRACE(cname, fun, msg) CAF_LOGC(CAF_TRACE, cname, fun, msg)
CAF_LOGC(CAF_TRACE, cname, fname, msg)
#define CAF_LOGC_ERROR_IF(stmt, cname, fname, msg) \ #define CAF_LOGC_ERROR_IF(stmt, cname, fun, msg) \
CAF_LOGC_IF(stmt, CAF_ERROR, cname, fname, msg) CAF_LOGC_IF(stmt, CAF_ERROR, cname, fun, msg)
#define CAF_LOGC_WARNING_IF(stmt, cname, fname, msg) \ #define CAF_LOGC_WARNING_IF(stmt, cname, fun, msg) \
CAF_LOGC_IF(stmt, CAF_WARNING, cname, fname, msg) CAF_LOGC_IF(stmt, CAF_WARNING, cname, fun, msg)
#define CAF_LOGC_DEBUG_IF(stmt, cname, fname, msg) \ #define CAF_LOGC_DEBUG_IF(stmt, cname, fun, msg) \
CAF_LOGC_IF(stmt, CAF_DEBUG, cname, fname, msg) CAF_LOGC_IF(stmt, CAF_DEBUG, cname, fun, msg)
#define CAF_LOGC_INFO_IF(stmt, cname, fname, msg) \ #define CAF_LOGC_INFO_IF(stmt, cname, fun, msg) \
CAF_LOGC_IF(stmt, CAF_INFO, cname, fname, msg) CAF_LOGC_IF(stmt, CAF_INFO, cname, fun, msg)
#define CAF_LOGC_TRACE_IF(stmt, cname, fname, msg) \ #define CAF_LOGC_TRACE_IF(stmt, cname, fun, msg) \
CAF_LOGC_IF(stmt, CAF_TRACE, cname, fname, msg) CAF_LOGC_IF(stmt, CAF_TRACE, cname, fun, msg)
#define CAF_LOGF_ERROR(msg) CAF_LOGF(CAF_ERROR, msg) #define CAF_LOGF_ERROR(msg) CAF_LOGF(CAF_ERROR, msg)
#define CAF_LOGF_WARNING(msg) CAF_LOGF(CAF_WARNING, msg) #define CAF_LOGF_WARNING(msg) CAF_LOGF(CAF_WARNING, msg)
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "caf/mixin/memory_cached.hpp" #include "caf/mixin/memory_cached.hpp"
#include "caf/detail/logging.hpp"
#include "caf/detail/behavior_stack.hpp" #include "caf/detail/behavior_stack.hpp"
#include "caf/detail/typed_actor_util.hpp" #include "caf/detail/typed_actor_util.hpp"
#include "caf/detail/single_reader_queue.hpp" #include "caf/detail/single_reader_queue.hpp"
......
...@@ -61,8 +61,8 @@ class event_based_resume { ...@@ -61,8 +61,8 @@ class event_based_resume {
size_t max_throughput) override { size_t max_throughput) override {
CAF_REQUIRE(max_throughput > 0); CAF_REQUIRE(max_throughput > 0);
auto d = static_cast<Derived*>(this); auto d = static_cast<Derived*>(this);
d->host(new_host);
CAF_LOG_TRACE("id = " << d->id()); CAF_LOG_TRACE("id = " << d->id());
d->host(new_host);
auto done_cb = [&]() -> bool { auto done_cb = [&]() -> bool {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
d->bhvr_stack().clear(); d->bhvr_stack().clear();
......
...@@ -89,6 +89,7 @@ class invoke_policy { ...@@ -89,6 +89,7 @@ class invoke_policy {
if (!node_ptr) { if (!node_ptr) {
return false; return false;
} }
CAF_LOG_TRACE("");
switch (handle_message(self, node_ptr.get(), fun, awaited_response)) { switch (handle_message(self, node_ptr.get(), fun, awaited_response)) {
case hm_msg_handled: case hm_msg_handled:
node_ptr.reset(); node_ptr.reset();
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "caf/exception.hpp" #include "caf/exception.hpp"
#include "caf/exit_reason.hpp" #include "caf/exit_reason.hpp"
#include "caf/detail/logging.hpp"
#include "caf/policy/resume_policy.hpp" #include "caf/policy/resume_policy.hpp"
namespace caf { namespace caf {
...@@ -29,6 +30,7 @@ class no_resume { ...@@ -29,6 +30,7 @@ class no_resume {
} }
resumable::resume_result resume(execution_unit*, size_t) { resumable::resume_result resume(execution_unit*, size_t) {
CAF_LOG_TRACE("");
uint32_t rsn = exit_reason::normal; uint32_t rsn = exit_reason::normal;
try { try {
this->act(); this->act();
......
...@@ -34,7 +34,9 @@ namespace caf { ...@@ -34,7 +34,9 @@ namespace caf {
namespace { namespace {
struct impl : blocking_actor { struct impl : blocking_actor {
void act() override {} void act() override {
CAF_LOG_ERROR("act() of scoped_actor impl called");
}
}; };
blocking_actor* alloc() { blocking_actor* alloc() {
...@@ -48,10 +50,11 @@ blocking_actor* alloc() { ...@@ -48,10 +50,11 @@ blocking_actor* alloc() {
void scoped_actor::init(bool hide_actor) { void scoped_actor::init(bool hide_actor) {
m_self.reset(alloc()); m_self.reset(alloc());
m_self->is_registered(!hide_actor);
if (!hide_actor) { if (!hide_actor) {
m_prev = CAF_SET_AID(m_self->id()); m_prev = CAF_SET_AID(m_self->id());
} }
CAF_LOG_TRACE(CAF_ARG(hide_actor));
m_self->is_registered(!hide_actor);
} }
scoped_actor::scoped_actor() { scoped_actor::scoped_actor() {
...@@ -63,6 +66,7 @@ scoped_actor::scoped_actor(bool hide_actor) { ...@@ -63,6 +66,7 @@ scoped_actor::scoped_actor(bool hide_actor) {
} }
scoped_actor::~scoped_actor() { scoped_actor::~scoped_actor() {
CAF_LOG_TRACE("");
if (m_self->is_registered()) { if (m_self->is_registered()) {
CAF_SET_AID(m_prev); CAF_SET_AID(m_prev);
} }
......
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