Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
a0f6b4af
Commit
a0f6b4af
authored
Sep 11, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve logging
parent
7076ae18
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
8 deletions
+28
-8
libcaf_core/caf/detail/logging.hpp
libcaf_core/caf/detail/logging.hpp
+1
-0
libcaf_core/caf/policy/event_based_resume.hpp
libcaf_core/caf/policy/event_based_resume.hpp
+7
-0
libcaf_core/caf/to_string.hpp
libcaf_core/caf/to_string.hpp
+3
-5
libcaf_core/src/abstract_actor.cpp
libcaf_core/src/abstract_actor.cpp
+7
-2
libcaf_core/src/node_id.cpp
libcaf_core/src/node_id.cpp
+1
-1
libcaf_core/src/string_serialization.cpp
libcaf_core/src/string_serialization.cpp
+9
-0
No files found.
libcaf_core/caf/detail/logging.hpp
View file @
a0f6b4af
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <type_traits>
#include <type_traits>
#include "caf/config.hpp"
#include "caf/config.hpp"
#include "caf/to_string.hpp"
#include "caf/abstract_actor.hpp"
#include "caf/abstract_actor.hpp"
#include "caf/detail/demangle.hpp"
#include "caf/detail/demangle.hpp"
...
...
libcaf_core/caf/policy/event_based_resume.hpp
View file @
a0f6b4af
...
@@ -95,13 +95,20 @@ class event_based_resume {
...
@@ -95,13 +95,20 @@ class event_based_resume {
&&
d
->
planned_exit_reason
()
==
exit_reason
::
not_exited
));
&&
d
->
planned_exit_reason
()
==
exit_reason
::
not_exited
));
try
{
try
{
if
(
!
d
->
is_initialized
())
{
if
(
!
d
->
is_initialized
())
{
CAF_LOG_DEBUG
(
"initialize actor"
);
d
->
is_initialized
(
true
);
d
->
is_initialized
(
true
);
auto
bhvr
=
d
->
make_behavior
();
auto
bhvr
=
d
->
make_behavior
();
CAF_LOG_DEBUG_IF
(
!
bhvr
,
"make_behavior() did not return a behavior, "
<<
"bhvr_stack().empty() = "
<<
std
::
boolalpha
<<
d
->
bhvr_stack
().
empty
());
if
(
bhvr
)
{
if
(
bhvr
)
{
// make_behavior() did return a behavior instead of using become()
// make_behavior() did return a behavior instead of using become()
CAF_LOG_DEBUG
(
"make_behavior() did return a valid behavior"
);
d
->
become
(
std
::
move
(
bhvr
));
d
->
become
(
std
::
move
(
bhvr
));
}
}
if
(
actor_done
())
{
if
(
actor_done
())
{
CAF_LOG_DEBUG
(
"actor_done() returned true right "
<<
"after make_behavior()"
);
return
resume_result
::
done
;
return
resume_result
::
done
;
}
}
}
}
...
...
libcaf_core/caf/to_string.hpp
View file @
a0f6b4af
...
@@ -52,15 +52,13 @@ inline std::string to_string_impl(const T& what) {
...
@@ -52,15 +52,13 @@ inline std::string to_string_impl(const T& what) {
}
// namespace detail
}
// namespace detail
inline
std
::
string
to_string
(
const
message
&
what
)
{
std
::
string
to_string
(
const
actor_addr
&
what
);
return
detail
::
to_string_impl
(
what
);
}
inline
std
::
string
to_string
(
const
actor
&
what
)
{
inline
std
::
string
to_string
(
const
actor
&
what
)
{
return
detail
::
to_string_impl
(
what
);
return
to_string
(
what
.
address
()
);
}
}
inline
std
::
string
to_string
(
const
actor_addr
&
what
)
{
inline
std
::
string
to_string
(
const
message
&
what
)
{
return
detail
::
to_string_impl
(
what
);
return
detail
::
to_string_impl
(
what
);
}
}
...
...
libcaf_core/src/abstract_actor.cpp
View file @
a0f6b4af
...
@@ -102,11 +102,13 @@ size_t abstract_actor::detach_impl(const attachable::token& what,
...
@@ -102,11 +102,13 @@ size_t abstract_actor::detach_impl(const attachable::token& what,
}
}
void
abstract_actor
::
detach
(
const
attachable
::
token
&
what
)
{
void
abstract_actor
::
detach
(
const
attachable
::
token
&
what
)
{
CAF_LOG_TRACE
(
""
);
guard_type
guard
{
m_mtx
};
guard_type
guard
{
m_mtx
};
detach_impl
(
what
,
m_attachables_head
);
detach_impl
(
what
,
m_attachables_head
);
}
}
bool
abstract_actor
::
link_impl
(
linking_operation
op
,
const
actor_addr
&
other
)
{
bool
abstract_actor
::
link_impl
(
linking_operation
op
,
const
actor_addr
&
other
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
op
)
<<
", "
<<
CAF_TSARG
(
other
));
switch
(
op
)
{
switch
(
op
)
{
case
establish_link_op
:
case
establish_link_op
:
return
establish_link_impl
(
other
);
return
establish_link_impl
(
other
);
...
@@ -121,6 +123,7 @@ bool abstract_actor::link_impl(linking_operation op, const actor_addr& other) {
...
@@ -121,6 +123,7 @@ bool abstract_actor::link_impl(linking_operation op, const actor_addr& other) {
}
}
bool
abstract_actor
::
establish_link_impl
(
const
actor_addr
&
other
)
{
bool
abstract_actor
::
establish_link_impl
(
const
actor_addr
&
other
)
{
CAF_LOG_TRACE
(
CAF_TSARG
(
other
));
if
(
other
&&
other
!=
this
)
{
if
(
other
&&
other
!=
this
)
{
guard_type
guard
{
m_mtx
};
guard_type
guard
{
m_mtx
};
auto
ptr
=
actor_cast
<
abstract_actor_ptr
>
(
other
);
auto
ptr
=
actor_cast
<
abstract_actor_ptr
>
(
other
);
...
@@ -140,6 +143,7 @@ bool abstract_actor::establish_link_impl(const actor_addr& other) {
...
@@ -140,6 +143,7 @@ bool abstract_actor::establish_link_impl(const actor_addr& other) {
}
}
bool
abstract_actor
::
establish_backlink_impl
(
const
actor_addr
&
other
)
{
bool
abstract_actor
::
establish_backlink_impl
(
const
actor_addr
&
other
)
{
CAF_LOG_TRACE
(
CAF_TSARG
(
other
));
uint32_t
reason
=
exit_reason
::
not_exited
;
uint32_t
reason
=
exit_reason
::
not_exited
;
default_attachable
::
observe_token
tk
{
other
,
default_attachable
::
link
};
default_attachable
::
observe_token
tk
{
other
,
default_attachable
::
link
};
if
(
other
&&
other
!=
this
)
{
if
(
other
&&
other
!=
this
)
{
...
@@ -163,6 +167,7 @@ bool abstract_actor::establish_backlink_impl(const actor_addr& other) {
...
@@ -163,6 +167,7 @@ bool abstract_actor::establish_backlink_impl(const actor_addr& other) {
}
}
bool
abstract_actor
::
remove_link_impl
(
const
actor_addr
&
other
)
{
bool
abstract_actor
::
remove_link_impl
(
const
actor_addr
&
other
)
{
CAF_LOG_TRACE
(
CAF_TSARG
(
other
));
if
(
!
other
)
{
if
(
!
other
)
{
return
false
;
return
false
;
}
}
...
@@ -178,6 +183,7 @@ bool abstract_actor::remove_link_impl(const actor_addr& other) {
...
@@ -178,6 +183,7 @@ bool abstract_actor::remove_link_impl(const actor_addr& other) {
}
}
bool
abstract_actor
::
remove_backlink_impl
(
const
actor_addr
&
other
)
{
bool
abstract_actor
::
remove_backlink_impl
(
const
actor_addr
&
other
)
{
CAF_LOG_TRACE
(
CAF_TSARG
(
other
));
default_attachable
::
observe_token
tk
{
other
,
default_attachable
::
link
};
default_attachable
::
observe_token
tk
{
other
,
default_attachable
::
link
};
if
(
other
&&
other
!=
this
)
{
if
(
other
&&
other
!=
this
)
{
guard_type
guard
{
m_mtx
};
guard_type
guard
{
m_mtx
};
...
@@ -191,8 +197,7 @@ actor_addr abstract_actor::address() const {
...
@@ -191,8 +197,7 @@ actor_addr abstract_actor::address() const {
}
}
void
abstract_actor
::
cleanup
(
uint32_t
reason
)
{
void
abstract_actor
::
cleanup
(
uint32_t
reason
)
{
// log as 'actor'
CAF_LOG_TRACE
(
CAF_ARG
(
reason
));
CAF_LOGM_TRACE
(
"caf::actor"
,
CAF_ARG
(
m_id
)
<<
", "
<<
CAF_ARG
(
reason
));
CAF_REQUIRE
(
reason
!=
exit_reason
::
not_exited
);
CAF_REQUIRE
(
reason
!=
exit_reason
::
not_exited
);
// move everyhting out of the critical section before processing it
// move everyhting out of the critical section before processing it
attachable_ptr
head
;
attachable_ptr
head
;
...
...
libcaf_core/src/node_id.cpp
View file @
a0f6b4af
...
@@ -164,7 +164,7 @@ int node_id::compare(const node_id& other) const {
...
@@ -164,7 +164,7 @@ int node_id::compare(const node_id& other) const {
std
::
string
to_string
(
const
node_id
&
what
)
{
std
::
string
to_string
(
const
node_id
&
what
)
{
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
what
.
process_id
()
<<
"@"
<<
to_string
(
what
.
host_id
()
);
oss
<<
to_string
(
what
.
host_id
())
<<
":"
<<
what
.
process_id
(
);
return
oss
.
str
();
return
oss
.
str
();
}
}
...
...
libcaf_core/src/string_serialization.cpp
View file @
a0f6b4af
...
@@ -512,6 +512,15 @@ string to_string_impl(const void* what, const uniform_type_info* utype) {
...
@@ -512,6 +512,15 @@ string to_string_impl(const void* what, const uniform_type_info* utype) {
}
// namespace detail
}
// namespace detail
std
::
string
to_string
(
const
actor_addr
&
what
)
{
if
(
what
==
invalid_actor_addr
)
{
return
"0@00000000000000000000:0"
;
}
std
::
ostringstream
oss
;
oss
<<
what
.
id
()
<<
"@"
<<
to_string
(
what
.
node
());
return
oss
.
str
();
}
string
to_verbose_string
(
const
std
::
exception
&
e
)
{
string
to_verbose_string
(
const
std
::
exception
&
e
)
{
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
detail
::
demangle
(
typeid
(
e
))
<<
": "
<<
e
.
what
();
oss
<<
detail
::
demangle
(
typeid
(
e
))
<<
": "
<<
e
.
what
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment