Logging shortcuts return void, since logging functions are not expected to fail in most cases

This commit is contained in:
Pavel Kirienko
2014-04-01 23:15:35 +04:00
parent 8fbcf82cd6
commit 5d737cf171
2 changed files with 13 additions and 13 deletions
+12 -12
View File
@@ -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
+1 -1
View File
@@ -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)));