mirror of
https://github.com/espressif/openthread.git
synced 2026-10-31 19:46:31 +00:00
[log] add compile-time check for printf style arg check to log functions (#8339)
This commit adds compile-time check of format string to all log functions and macros. It also updates different core modules to make arg string formats consistent under different platforms. In particular we use `'%lu` for `uint32_t` arguments and they are explicitly cast to `unsigned long` using `ToUlong()`.
This commit is contained in:
@@ -228,7 +228,7 @@ void Notifier::LogEvents(Events aEvents) const
|
||||
{
|
||||
if (string.GetLength() >= kFlagsStringLineLimit)
|
||||
{
|
||||
LogInfo("StateChanged (0x%08x) %s%s ...", aEvents.GetAsFlags(), didLog ? "... " : "[",
|
||||
LogInfo("StateChanged (0x%08lx) %s%s ...", ToUlong(aEvents.GetAsFlags()), didLog ? "... " : "[",
|
||||
string.AsCString());
|
||||
string.Clear();
|
||||
didLog = true;
|
||||
@@ -243,7 +243,7 @@ void Notifier::LogEvents(Events aEvents) const
|
||||
}
|
||||
|
||||
exit:
|
||||
LogInfo("StateChanged (0x%08x) %s%s]", aEvents.GetAsFlags(), didLog ? "... " : "[", string.AsCString());
|
||||
LogInfo("StateChanged (0x%08lx) %s%s]", ToUlong(aEvents.GetAsFlags()), didLog ? "... " : "[", string.AsCString());
|
||||
}
|
||||
|
||||
const char *Notifier::EventToString(Event aEvent) const
|
||||
|
||||
Reference in New Issue
Block a user