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
76831743
Commit
76831743
authored
Jun 22, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use scope guard for trace logging
parent
74f07337
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
36 deletions
+7
-36
libcaf_core/caf/logger.hpp
libcaf_core/caf/logger.hpp
+7
-19
libcaf_core/src/logger.cpp
libcaf_core/src/logger.cpp
+0
-17
No files found.
libcaf_core/caf/logger.hpp
View file @
76831743
...
@@ -131,21 +131,6 @@ public:
...
@@ -131,21 +131,6 @@ public:
/** @cond PRIVATE */
/** @cond PRIVATE */
class
trace_helper
{
public:
trace_helper
(
std
::
string
class_name
,
const
char
*
fun_name
,
const
char
*
file_name
,
int
line_num
,
const
std
::
string
&
msg
);
~
trace_helper
();
private:
logger
*
parent_
;
std
::
string
class_
;
const
char
*
fun_name_
;
const
char
*
file_name_
;
int
line_num_
;
};
static
void
set_current_actor_system
(
actor_system
*
);
static
void
set_current_actor_system
(
actor_system
*
);
static
logger
*
current_logger
();
static
logger
*
current_logger
();
...
@@ -266,10 +251,13 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
...
@@ -266,10 +251,13 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
#else // CAF_LOG_LEVEL < CAF_LOG_LEVEL_TRACE
#else // CAF_LOG_LEVEL < CAF_LOG_LEVEL_TRACE
#define CAF_LOG_TRACE(entry_message) \
#define CAF_LOG_TRACE(entry_message) \
caf::logger::trace_helper CAF_UNIFYN(caf_log_trace_) { \
const char* CAF_UNIFYN(func_name_) = __func__; \
CAF_GET_CLASS_NAME, __func__, __FILE__, __LINE__, \
CAF_LOG_IMPL(CAF_LOG_LEVEL_TRACE, "ENTRY" << entry_message); \
(caf::logger::line_builder{} << entry_message).get() \
auto CAF_UNIFYN(caf_log_trace_guard_) = ::caf::detail::make_scope_guard([=] {\
}
caf::logger::log_static(CAF_LOG_LEVEL_TRACE, CAF_GET_CLASS_NAME, \
CAF_UNIFYN(func_name_), __FILE__, __LINE__, \
"EXIT"); \
})
#endif // CAF_LOG_LEVEL < CAF_LOG_LEVEL_TRACE
#endif // CAF_LOG_LEVEL < CAF_LOG_LEVEL_TRACE
...
...
libcaf_core/src/logger.cpp
View file @
76831743
...
@@ -237,23 +237,6 @@ void logger::log(int level, const std::string& class_name,
...
@@ -237,23 +237,6 @@ void logger::log(int level, const std::string& class_name,
queue_
.
synchronized_enqueue
(
queue_mtx_
,
queue_cv_
,
new
event
{
line
.
str
()});
queue_
.
synchronized_enqueue
(
queue_mtx_
,
queue_cv_
,
new
event
{
line
.
str
()});
}
}
logger
::
trace_helper
::
trace_helper
(
std
::
string
class_name
,
const
char
*
fun_name
,
const
char
*
file_name
,
int
line_num
,
const
std
::
string
&
msg
)
:
parent_
(
current_logger
()),
class_
(
std
::
move
(
class_name
)),
fun_name_
(
fun_name
),
file_name_
(
file_name
),
line_num_
(
line_num
)
{
if
(
parent_
)
parent_
->
log
(
4
,
class_
,
fun_name
,
file_name
,
line_num
,
"ENTRY "
+
msg
);
}
logger
::
trace_helper
::~
trace_helper
()
{
if
(
parent_
)
parent_
->
log
(
4
,
class_
.
c_str
(),
fun_name_
,
file_name_
,
line_num_
,
"EXIT"
);
}
void
logger
::
set_current_actor_system
(
actor_system
*
x
)
{
void
logger
::
set_current_actor_system
(
actor_system
*
x
)
{
current_logger_system
(
x
);
current_logger_system
(
x
);
}
}
...
...
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