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
fffcaf17
Commit
fffcaf17
authored
8 years ago
by
Jeremie Deray
Browse files
Options
Downloads
Patches
Plain Diff
add proper trace & set trace color green+bold
parent
b4d3dd70
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/logging.h
+14
-1
14 additions, 1 deletion
src/logging.h
third_party/spdlog/include/spdlog/sinks/ansicolor_sink.h
+1
-1
1 addition, 1 deletion
third_party/spdlog/include/spdlog/sinks/ansicolor_sink.h
with
15 additions
and
2 deletions
src/logging.h
+
14
−
1
View file @
fffcaf17
...
@@ -48,6 +48,9 @@ public:
...
@@ -48,6 +48,9 @@ public:
template
<
typename
...
Args
>
template
<
typename
...
Args
>
void
debug
(
const
Args
&
...
args
);
void
debug
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
trace
(
const
Args
&
...
args
);
void
enable_debug
(
const
bool
enable
);
void
enable_debug
(
const
bool
enable
);
bool
enable_debug
();
bool
enable_debug
();
...
@@ -93,6 +96,10 @@ Logger::Logger()
...
@@ -93,6 +96,10 @@ Logger::Logger()
enable_debug
(
true
);
enable_debug
(
true
);
#endif
#endif
#ifdef _WOLF_TRACE
console_
->
set_level
(
spdlog
::
level
::
trace
);
#endif
// Enable asynchronous logging
// Enable asynchronous logging
// Queue size must be a power of 2
// Queue size must be a power of 2
spdlog
::
set_async_mode
(
4096
);
spdlog
::
set_async_mode
(
4096
);
...
@@ -131,6 +138,12 @@ void Logger::debug(const Args&... args)
...
@@ -131,6 +138,12 @@ void Logger::debug(const Args&... args)
console_
->
debug
(
repeat_string
(
"{}"
,
sizeof
...(
args
)).
c_str
(),
args
...);
console_
->
debug
(
repeat_string
(
"{}"
,
sizeof
...(
args
)).
c_str
(),
args
...);
}
}
template
<
typename
...
Args
>
void
Logger
::
trace
(
const
Args
&
...
args
)
{
console_
->
trace
(
repeat_string
(
"{}"
,
sizeof
...(
args
)).
c_str
(),
args
...);
}
inline
void
Logger
::
enable_debug
(
const
bool
enable
)
inline
void
Logger
::
enable_debug
(
const
bool
enable
)
{
{
(
enable
)
?
console_
->
set_level
(
spdlog
::
level
::
debug
)
:
(
enable
)
?
console_
->
set_level
(
spdlog
::
level
::
debug
)
:
...
@@ -180,7 +193,7 @@ inline bool Logger::set_async_queue(const std::size_t q_size)
...
@@ -180,7 +193,7 @@ inline bool Logger::set_async_queue(const std::size_t q_size)
#ifdef _WOLF_TRACE
#ifdef _WOLF_TRACE
#define WOLF_TRACE(...) \
#define WOLF_TRACE(...) \
char this_file[] = __FILE__;\
char this_file[] = __FILE__;\
WOLF_WARN
("[", basename(this_file), " l#", __LINE__, \
wolf::internal::Logger::get().trace
("[", basename(this_file), " l#", __LINE__, \
" : ", __FUNCTION__, "] ", __VA_ARGS__)
" : ", __FUNCTION__, "] ", __VA_ARGS__)
#else
#else
#define WOLF_TRACE(...)
#define WOLF_TRACE(...)
...
...
This diff is collapsed.
Click to expand it.
third_party/spdlog/include/spdlog/sinks/ansicolor_sink.h
+
1
−
1
View file @
fffcaf17
...
@@ -72,7 +72,7 @@ protected:
...
@@ -72,7 +72,7 @@ protected:
inline
ansicolor_sink
::
ansicolor_sink
(
sink_ptr
wrapped_sink
)
:
sink_
(
wrapped_sink
)
inline
ansicolor_sink
::
ansicolor_sink
(
sink_ptr
wrapped_sink
)
:
sink_
(
wrapped_sink
)
{
{
colors_
[
level
::
trace
]
=
cyan
;
colors_
[
level
::
trace
]
=
green
+
bold
;
colors_
[
level
::
debug
]
=
cyan
;
colors_
[
level
::
debug
]
=
cyan
;
colors_
[
level
::
info
]
=
bold
;
colors_
[
level
::
info
]
=
bold
;
colors_
[
level
::
warn
]
=
yellow
+
bold
;
colors_
[
level
::
warn
]
=
yellow
+
bold
;
...
...
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