mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-04 00:11:36 +08:00
Logging shortcuts return void, since logging functions are not expected to fail in most cases
This commit is contained in:
@@ -184,35 +184,35 @@ public:
|
|||||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline int logDebug(const char* source, const char* format, Args... args)
|
inline void logDebug(const char* source, const char* format, Args... args)
|
||||||
{
|
{
|
||||||
return proto_logger_.logDebug(source, format, args...);
|
(void)proto_logger_.logDebug(source, format, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline int logInfo(const char* source, const char* format, Args... args)
|
inline void logInfo(const char* source, const char* format, Args... args)
|
||||||
{
|
{
|
||||||
return proto_logger_.logInfo(source, format, args...);
|
(void)proto_logger_.logInfo(source, format, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline int logWarning(const char* source, const char* format, Args... args)
|
inline void logWarning(const char* source, const char* format, Args... args)
|
||||||
{
|
{
|
||||||
return proto_logger_.logWarning(source, format, args...);
|
(void)proto_logger_.logWarning(source, format, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline int logError(const char* source, const char* format, Args... args)
|
inline void logError(const char* source, const char* format, Args... args)
|
||||||
{
|
{
|
||||||
return proto_logger_.logError(source, format, args...);
|
(void)proto_logger_.logError(source, format, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int logDebug(const char* source, const char* text) { return proto_logger_.logDebug(source, text); }
|
void logDebug(const char* source, const char* text) { (void)proto_logger_.logDebug(source, text); }
|
||||||
int logInfo(const char* source, const char* text) { return proto_logger_.logInfo(source, text); }
|
void logInfo(const char* source, const char* text) { (void)proto_logger_.logInfo(source, text); }
|
||||||
int logWarning(const char* source, const char* text) { return proto_logger_.logWarning(source, text); }
|
void logWarning(const char* source, const char* text) { (void)proto_logger_.logWarning(source, text); }
|
||||||
int logError(const char* source, const char* text) { return proto_logger_.logError(source, text); }
|
void logError(const char* source, const char* text) { (void)proto_logger_.logError(source, text); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ TEST(Node, Basic)
|
|||||||
ASSERT_LE(0, log_sub.start());
|
ASSERT_LE(0, log_sub.start());
|
||||||
|
|
||||||
node1.getLogger().setLevel(uavcan::protocol::debug::LogLevel::DEBUG);
|
node1.getLogger().setLevel(uavcan::protocol::debug::LogLevel::DEBUG);
|
||||||
ASSERT_LE(1, node1.logInfo("test", "6 * 9 = 42"));
|
node1.logInfo("test", "6 * 9 = 42");
|
||||||
|
|
||||||
ASSERT_LE(0, node1.spin(uavcan::MonotonicDuration::fromMSec(20)));
|
ASSERT_LE(0, node1.spin(uavcan::MonotonicDuration::fromMSec(20)));
|
||||||
ASSERT_LE(0, node2.spin(uavcan::MonotonicDuration::fromMSec(20)));
|
ASSERT_LE(0, node2.spin(uavcan::MonotonicDuration::fromMSec(20)));
|
||||||
|
|||||||
Reference in New Issue
Block a user