Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
dynamic-graph
Commits
f17106c5
Commit
f17106c5
authored
Jan 31, 2020
by
Joseph Mirabel
Committed by
olivier stasse
Jan 31, 2020
Browse files
Clean code.
parent
385429eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/dynamic-graph/logger.h
View file @
f17106c5
...
...
@@ -191,25 +191,7 @@ public:
* to decrement the internal Logger's counter. */
void
countdown
();
/** Check whether next message should be accepted.
* \note See Logger::stream to see how to use it.
* This will modify the counter associated to lineId as if it was
* published. It should thus be used in conjunction with Logger::stream.
*/
bool
acceptMsg
(
MsgType
m
,
const
std
::
string
&
lineId
)
{
if
((
m
&
MSG_TYPE_TYPE_BITS
)
<
m_lv
)
return
false
;
// if print is allowed by current verbosity level
if
(
isStreamMsg
(
m
))
return
checkStreamPeriod
(
lineId
);
return
true
;
}
/** The most efficient logging method is
* \code
* if (logger.acceptMsg(type, lineId))
* logger.stream() << "my message\n";
* \endcode
/** Get an output stream independently of the debug level.
*/
RTLoggerStream
stream
()
{
return
::
dynamicgraph
::
RealTimeLogger
::
instance
().
emptyStream
();
...
...
@@ -272,22 +254,22 @@ protected:
return
(
m
&
MSG_TYPE_STREAM_BIT
);
}
bool
isDebugMsg
(
MsgType
m
)
{
return
m
==
MSG_TYPE_DEBUG_STREAM
||
m
==
MSG_TYPE_DEBUG
;
}
bool
isInfoMsg
(
MsgType
m
)
{
return
m
==
MSG_TYPE_INFO_STREAM
||
m
==
MSG_TYPE_INFO
;
}
bool
isWarningMsg
(
MsgType
m
)
{
return
m
==
MSG_TYPE_WARNING_STREAM
||
m
==
MSG_TYPE_WARNING
;
}
/** Check whether a message of type \m and from \c lineId should be accepted.
* \note If \c is a stream type, the internal counter associated to \c lineId
* is updated.
*/
bool
acceptMsg
(
MsgType
m
,
const
std
::
string
&
lineId
)
{
if
((
m
&
MSG_TYPE_TYPE_BITS
)
<
m_lv
)
return
false
;
bool
isErrorMsg
(
MsgType
m
)
{
return
m
==
MSG_TYPE_ERROR_STREAM
||
m
==
MSG_TYPE_ERROR
;
// if print is allowed by current verbosity level
if
(
isStreamMsg
(
m
))
return
checkStreamPeriod
(
lineId
);
return
true
;
}
/** Check whether a message from \c lineId should be accepted.
* \note The internal counter associated to \c lineId is updated.
*/
bool
checkStreamPeriod
(
const
std
::
string
&
lineId
);
};
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment