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
8a072b53
Commit
8a072b53
authored
Nov 26, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error when compiling without logging
parent
59801ea6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
libcaf_core/caf/logger.hpp
libcaf_core/caf/logger.hpp
+0
-2
libcaf_core/src/logger.cpp
libcaf_core/src/logger.cpp
+8
-10
No files found.
libcaf_core/caf/logger.hpp
View file @
8a072b53
...
@@ -209,8 +209,6 @@ private:
...
@@ -209,8 +209,6 @@ private:
// placeholder macros when compiling without logging
// placeholder macros when compiling without logging
inline
caf
::
actor_id
caf_set_aid_dummy
()
{
return
0
;
}
inline
caf
::
actor_id
caf_set_aid_dummy
()
{
return
0
;
}
#define CAF_LOG_IMPL(lvlname, classname, funname, message) \
CAF_PRINT_ERROR_IMPL(lvlname, classname, funname, message)
#define CAF_PUSH_AID(unused) CAF_VOID_STMT
#define CAF_PUSH_AID(unused) CAF_VOID_STMT
...
...
libcaf_core/src/logger.cpp
View file @
8a072b53
...
@@ -56,7 +56,10 @@ constexpr const char* log_level_name[] = {
...
@@ -56,7 +56,10 @@ constexpr const char* log_level_name[] = {
};
};
#ifdef CAF_LOG_LEVEL
#ifdef CAF_LOG_LEVEL
constexpr
int
global_log_level
=
0
;
static_assert
(
CAF_LOG_LEVEL
>=
0
&&
CAF_LOG_LEVEL
<=
4
,
"assertion: 0 <= CAF_LOG_LEVEL <= 4"
);
constexpr
int
global_log_level
=
CAF_LOG_LEVEL
;
#ifdef CAF_MSVC
#ifdef CAF_MSVC
thread_local
thread_local
...
@@ -78,15 +81,6 @@ inline logger* get_current_logger() {
...
@@ -78,15 +81,6 @@ inline logger* get_current_logger() {
return
sys
?
&
sys
->
logger
()
:
nullptr
;
return
sys
?
&
sys
->
logger
()
:
nullptr
;
}
}
#else
#else
static_assert
(
CAF_LOG_LEVEL
>=
0
&&
CAF_LOG_LEVEL
<=
4
,
"assertion: 0 <= CAF_LOG_LEVEL <= 4"
);
constexpr
int
global_log_level
=
CAF_LOG_LEVEL
;
inline
actor_system
*
current_logger_system
()
{
return
nullptr
;
}
inline
void
current_logger_system
(
actor_system
*
)
{
inline
void
current_logger_system
(
actor_system
*
)
{
// nop
// nop
}
}
...
@@ -305,18 +299,22 @@ void logger::run() {
...
@@ -305,18 +299,22 @@ void logger::run() {
}
}
void
logger
::
start
()
{
void
logger
::
start
()
{
# ifdef CAF_LOG_LEVEL
const
char
*
log_level_table
[]
=
{
"ERROR"
,
"WARN"
,
"INFO"
,
"DEBUG"
,
"TRACE"
};
const
char
*
log_level_table
[]
=
{
"ERROR"
,
"WARN"
,
"INFO"
,
"DEBUG"
,
"TRACE"
};
thread_
=
std
::
thread
{[
this
]
{
this
->
run
();
}};
thread_
=
std
::
thread
{[
this
]
{
this
->
run
();
}};
std
::
string
msg
=
"ENTRY log level = "
;
std
::
string
msg
=
"ENTRY log level = "
;
msg
+=
log_level_table
[
global_log_level
];
msg
+=
log_level_table
[
global_log_level
];
log
(
4
,
"caf::logger"
,
"run"
,
__FILE__
,
__LINE__
,
msg
);
log
(
4
,
"caf::logger"
,
"run"
,
__FILE__
,
__LINE__
,
msg
);
# endif
}
}
void
logger
::
stop
()
{
void
logger
::
stop
()
{
# ifdef CAF_LOG_LEVEL
log
(
4
,
"caf::logger"
,
"run"
,
__FILE__
,
__LINE__
,
"EXIT"
);
log
(
4
,
"caf::logger"
,
"run"
,
__FILE__
,
__LINE__
,
"EXIT"
);
// an empty string means: shut down
// an empty string means: shut down
queue_
.
synchronized_enqueue
(
queue_mtx_
,
queue_cv_
,
new
event
{
""
});
queue_
.
synchronized_enqueue
(
queue_mtx_
,
queue_cv_
,
new
event
{
""
});
thread_
.
join
();
thread_
.
join
();
# endif
}
}
}
// namespace caf
}
// namespace caf
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