logging: Log warning and drop too big message

When packacge exceeds the limitation warning log is printed
and message is dropped.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2023-02-16 13:54:40 +01:00 committed by Marti Bolivar
parent 24ad096232
commit a5979dcfa1

View file

@ -63,10 +63,12 @@ void z_impl_z_log_msg_static_create(const void *source,
NULL, 0, flags, NULL, 0, flags,
strl, ARRAY_SIZE(strl)); strl, ARRAY_SIZE(strl));
if (len > Z_LOG_MSG_MAX_PACKAGE) if (len > Z_LOG_MSG_MAX_PACKAGE) {
{ struct cbprintf_package_hdr_ext *pkg =
LOG_WRN("Log message dropped because it exceeds current limitation (%u)", (struct cbprintf_package_hdr_ext *)package;
(uint32_t)Z_LOG_MSG_MAX_PACKAGE);
LOG_WRN("Message (\"%s\") dropped because it exceeds size limitation (%u)",
pkg->fmt, (uint32_t)Z_LOG_MSG_MAX_PACKAGE);
return; return;
} }
/* Update package length with calculated value (which may be extended /* Update package length with calculated value (which may be extended