mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Out of line Logger methods
This commit is contained in:
parent
dd38c38ff2
commit
9e5115948b
@ -78,19 +78,7 @@ public:
|
||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||
|
||||
template <typename... 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;
|
||||
}
|
||||
int log(LogLevel level, const char* source, const char* format, Args... args);
|
||||
|
||||
template <typename... Args>
|
||||
inline int logDebug(const char* source, const char* format, Args... args)
|
||||
@ -118,17 +106,7 @@ public:
|
||||
|
||||
#else
|
||||
|
||||
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 log(LogLevel level, const char* source, const char* text);
|
||||
|
||||
int logDebug(const char* source, const char* text)
|
||||
{
|
||||
@ -153,4 +131,23 @@ public:
|
||||
#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;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user