mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 03:03:34 +08:00
Out of line Logger methods
This commit is contained in:
@@ -78,19 +78,7 @@ public:
|
|||||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
int log(LogLevel level, const char* source, const char* format, Args... args)
|
int log(LogLevel level, const char* source, const char* format, Args... args);
|
||||||
{
|
|
||||||
if (level >= level_ || level >= getExternalSinkLevel())
|
|
||||||
{
|
|
||||||
msg_buf_.level.value = level;
|
|
||||||
msg_buf_.source = source;
|
|
||||||
msg_buf_.text.clear();
|
|
||||||
CharArrayFormatter<typename protocol::debug::LogMessage::FieldTypes::text> formatter(msg_buf_.text);
|
|
||||||
formatter.write(format, args...);
|
|
||||||
return log(msg_buf_);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline int logDebug(const char* source, const char* format, Args... args)
|
inline int logDebug(const char* source, const char* format, Args... args)
|
||||||
@@ -118,17 +106,7 @@ public:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int log(LogLevel level, const char* source, const char* text)
|
int log(LogLevel level, const char* source, const char* text);
|
||||||
{
|
|
||||||
if (level >= level_ || level >= getExternalSinkLevel())
|
|
||||||
{
|
|
||||||
msg_buf_.level.value = level;
|
|
||||||
msg_buf_.source = source;
|
|
||||||
msg_buf_.text = text;
|
|
||||||
return log(msg_buf_);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int logDebug(const char* source, const char* text)
|
int logDebug(const char* source, const char* text)
|
||||||
{
|
{
|
||||||
@@ -153,4 +131,23 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
int Logger::log(LogLevel level, const char* source, const char* format, Args... args)
|
||||||
|
{
|
||||||
|
if (level >= level_ || level >= getExternalSinkLevel())
|
||||||
|
{
|
||||||
|
msg_buf_.level.value = level;
|
||||||
|
msg_buf_.source = source;
|
||||||
|
msg_buf_.text.clear();
|
||||||
|
CharArrayFormatter<typename protocol::debug::LogMessage::FieldTypes::text> formatter(msg_buf_.text);
|
||||||
|
formatter.write(format, args...);
|
||||||
|
return log(msg_buf_);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,4 +34,20 @@ int Logger::log(const protocol::debug::LogMessage& message)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UAVCAN_CPP_VERSION < UAVCAN_CPP11
|
||||||
|
|
||||||
|
int Logger::log(LogLevel level, const char* source, const char* text)
|
||||||
|
{
|
||||||
|
if (level >= level_ || level >= getExternalSinkLevel())
|
||||||
|
{
|
||||||
|
msg_buf_.level.value = level;
|
||||||
|
msg_buf_.source = source;
|
||||||
|
msg_buf_.text = text;
|
||||||
|
return log(msg_buf_);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user