Open elBoberido opened 1 year ago
I think I found a nice way to restore lazy evaluation. catch2
has something like INFO("foo" << 42);
. We could do something similar with iceoryx, e.g. IOX_LOG(INFO, "foo" << 42);
. Something like IOX_LOG(INFO << "foo" << 42);
would be nicer but then lazy evaluation would again become a challenge.
@mossmaurice @MatthiasKillat @FerdinandSpitzschnueffler @dkroenke @elfenpiff what do you think. If you like the idea it should be done before the v3 release since the current logger API was not part of any release and would therefore also not be a breaking change if we apply the proposal.
The macro would basically look like
void force_semicolon(){};
#define IOX_LOG(level, msg_stream) \
if (shouldLog(level)) \
{ \
LogStream(...) << msg_stream \
} \
force_semicolon()
@elBoberido I like the idea. Would you have time to work on it?
@elBoberido I am also a fan of the idea. If you have time, go for it!
@FerdinandSpitzschnueffler I don't really have time but my friends find
, sed
and regex
will lend me a hand and in the end reviewing will be more time consuming than the actual change :)
Brief feature description
Enhance the basic logger implementation from #1345
Detailed information
LogStream& operator<<
instead of the templated method with SFINEA for arithmetic typesLogStream& operator(const bool value)
for e.g.IOX_LOG(INFO) << greater_or_equal<uint32_t, 42>(13)
if
statement without braces causes warnings in the static code analyzerchar
int8_t
anduint8_t
are supported which desugar tosigned char
andunsigned char
'a'
only"a"
worksConsoleLogger
-DIOX_LOGGER_PATH
cmake argument