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
c910209d
Commit
c910209d
authored
10 months ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
logging with colors
parent
0b373647
No related branches found
No related tags found
1 merge request
!476
spdlog version upgrade
Pipeline
#18553
canceled
10 months ago
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/core/utils/logging.h
+4
-4
4 additions, 4 deletions
include/core/utils/logging.h
test/gtest_logging.cpp
+10
-0
10 additions, 0 deletions
test/gtest_logging.cpp
with
14 additions
and
4 deletions
include/core/utils/logging.h
+
4
−
4
View file @
c910209d
...
...
@@ -135,13 +135,13 @@ inline Logger::Logger(const std::string& name) :
//set_pattern("[%t][%H:%M:%S.%F][%l] %v");
// [log type][MM/DD/YY - hour:minutes:seconds.nanoseconds] #log-content
// set_pattern("[%l][%x - %H:%M:%S.%F] %v");
set_pattern
(
"[%l][%H:%M:%S] %v"
);
set_pattern
(
"
%^
[%l][%H:%M:%S] %v
%$
"
);
else
// Logging pattern is :
// [logger name][thread num][hour:minutes:seconds.nanoseconds][log type] #log-content
//set_pattern("[" + log_name_ + "]" +"[%t][%H:%M:%S.%F][%l] %v");
// [log type][MM/DD/YY - hour:minutes:seconds.nanoseconds][logger name] #log-content
set_pattern
(
"[%l][%x - %H:%M:%S.%F]["
+
log_name_
+
"] %v"
);
set_pattern
(
"
%^
[%l][%x - %H:%M:%S.%F]["
+
log_name_
+
"] %v
%$
"
);
}
inline
Logger
::
Logger
(
std
::
string
&&
name
)
:
...
...
@@ -164,13 +164,13 @@ inline Logger::Logger(std::string&& name) :
//set_pattern("[%t][%H:%M:%S.%F][%l] %v");
// [log type][MM/DD/YY - hour:minutes:seconds.nanoseconds] #log-content
// set_pattern("[%l][%x - %H:%M:%S.%F] %v");
set_pattern
(
"[%l][%H:%M:%S] %v"
);
set_pattern
(
"
%^
[%l][%H:%M:%S] %v
%$
"
);
else
// Logging pattern is :
// [logger name][thread num][hour:minutes:seconds.nanoseconds][log type] #log-content
//set_pattern("[" + log_name_ + "]" +"[%t][%H:%M:%S.%F][%l] %v");
// [log type][MM/DD/YY - hour:minutes:seconds.nanoseconds][logger name] #log-content
set_pattern
(
"[%l][%x - %H:%M:%S.%F]["
+
log_name_
+
"] %v"
);
set_pattern
(
"
%^
[%l][%x - %H:%M:%S.%F]["
+
log_name_
+
"] %v
%$
"
);
}
inline
Logger
::~
Logger
()
...
...
This diff is collapsed.
Click to expand it.
test/gtest_logging.cpp
+
10
−
0
View file @
c910209d
...
...
@@ -33,26 +33,36 @@
TEST
(
logging
,
info
)
{
WOLF_INFO
(
"test info "
,
5
,
" "
,
0.123
);
WOLF_INFO_COND
(
true
,
"This message should appear!"
);
WOLF_INFO_COND
(
false
,
"This message should NOT appear!"
);
}
TEST
(
logging
,
warn
)
{
WOLF_WARN
(
"test warn "
,
5
,
" "
,
0.123
);
WOLF_WARN_COND
(
true
,
"This message should appear!"
);
WOLF_WARN_COND
(
false
,
"This message should NOT appear!"
);
}
TEST
(
logging
,
error
)
{
WOLF_ERROR
(
"test error "
,
5
,
" "
,
0.123
);
WOLF_ERROR_COND
(
true
,
"This message should appear!"
);
WOLF_ERROR_COND
(
false
,
"This message should NOT appear!"
);
}
TEST
(
logging
,
trace
)
{
WOLF_TRACE
(
"test trace "
,
5
,
" "
,
0.123
);
WOLF_TRACE_COND
(
true
,
"This message should appear!"
);
WOLF_TRACE_COND
(
false
,
"This message should NOT appear!"
);
}
TEST
(
logging
,
debug
)
{
WOLF_DEBUG
(
"test debug "
,
5
,
" "
,
0.123
);
WOLF_DEBUG_COND
(
true
,
"This message should appear!"
);
WOLF_DEBUG_COND
(
false
,
"This message should NOT appear!"
);
}
int
main
(
int
argc
,
char
**
argv
)
...
...
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