Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
b26a4888
Commit
b26a4888
authored
8 years ago
by
Jeremie Deray
Browse files
Options
Downloads
Patches
Plain Diff
debug macro compile time only
parent
fffcaf17
No related branches found
No related tags found
1 merge request
!99
Wolf logging macro
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/examples/test_wolf_logging.cpp
+0
-10
0 additions, 10 deletions
src/examples/test_wolf_logging.cpp
src/logging.h
+6
-29
6 additions, 29 deletions
src/logging.h
with
6 additions
and
39 deletions
src/examples/test_wolf_logging.cpp
+
0
−
10
View file @
b26a4888
...
...
@@ -20,15 +20,5 @@ int main(int, char*[])
WOLF_DEBUG
(
"test debug "
,
5
,
" "
,
0.123
);
// manually enable debug logging
WOLF_ENABLE_DEBUG_LOG
();
WOLF_DEBUG
(
"test enable debug"
);
// manually disable debug logging
WOLF_DISABLE_DEBUG_LOG
();
WOLF_DEBUG
(
"test disable debug"
);
return
0
;
}
This diff is collapsed.
Click to expand it.
src/logging.h
+
6
−
29
View file @
b26a4888
...
...
@@ -51,10 +51,6 @@ public:
template
<
typename
...
Args
>
void
trace
(
const
Args
&
...
args
);
void
enable_debug
(
const
bool
enable
);
bool
enable_debug
();
bool
set_async_queue
(
const
std
::
size_t
q_size
);
protected:
...
...
@@ -92,10 +88,6 @@ Logger::Logger()
// Create main logger
console_
=
spdlog
::
stdout_color_mt
(
log_name_
);
#ifdef _WOLF_DEBUG
enable_debug
(
true
);
#endif
#ifdef _WOLF_TRACE
console_
->
set_level
(
spdlog
::
level
::
trace
);
#endif
...
...
@@ -144,17 +136,6 @@ void Logger::trace(const Args&... args)
console_
->
trace
(
repeat_string
(
"{}"
,
sizeof
...(
args
)).
c_str
(),
args
...);
}
inline
void
Logger
::
enable_debug
(
const
bool
enable
)
{
(
enable
)
?
console_
->
set_level
(
spdlog
::
level
::
debug
)
:
console_
->
set_level
(
spdlog
::
level
::
info
);
}
inline
bool
Logger
::
enable_debug
()
{
return
console_
->
level
()
==
spdlog
::
level
::
debug
;
}
inline
bool
Logger
::
set_async_queue
(
const
std
::
size_t
q_size
)
{
bool
p2
=
q_size
%
2
==
0
;
...
...
@@ -176,20 +157,16 @@ inline bool Logger::set_async_queue(const std::size_t q_size)
#define WOLF_ERROR(...) \
wolf::internal::Logger::get().error(__VA_ARGS__);
#define WOLF_DEBUG(...) \
wolf::internal::Logger::get().debug(__VA_ARGS__);
#define WOLF_ENABLE_DEBUG_LOG() \
wolf::internal::Logger::get().enable_debug(true);
#define WOLF_DISABLE_DEBUG_LOG() \
wolf::internal::Logger::get().enable_debug(false);
#ifdef _WOLF_DEBUG
#define WOLF_DEBUG(...) \
wolf::internal::Logger::get().debug(__VA_ARGS__);
#else
#define WOLF_DEBUG(...)
#endif
#define WOLF_ASYNC_QUEUE_LOG(x) \
wolf::internal::Logger::get().set_async_queue(x);
// @Todo: re-assess TRACE level (info/debug/error)
// it should probably be custom while avoiding spdlog trace.
#ifdef _WOLF_TRACE
#define WOLF_TRACE(...) \
char this_file[] = __FILE__;\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment