logging: net: don't replace syslog timestamp

this way CONFIG_LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP
only uses the custom timestamps for
logs that are not send via syslog.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
Fin Maaß 2024-09-09 13:17:36 +02:00 committed by Mahesh Mahadevan
parent 3b697a29a2
commit 683ae11510
2 changed files with 4 additions and 5 deletions

View file

@ -189,6 +189,6 @@ config LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP
bool "Custom timestamp format support" bool "Custom timestamp format support"
help help
Enable support for custom formatter for the timestamp. Enable support for custom formatter for the timestamp.
It will be applied to all backends. It will be applied to all backends except the syslog net backend.
endmenu endmenu

View file

@ -252,10 +252,7 @@ static int timestamp_print(const struct log_output *output,
ms = (remainder * 1000U) / freq; ms = (remainder * 1000U) / freq;
us = (1000 * (remainder * 1000U - (ms * freq))) / freq; us = (1000 * (remainder * 1000U - (ms * freq))) / freq;
if (IS_ENABLED(CONFIG_LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP)) { if (IS_ENABLED(CONFIG_LOG_BACKEND_NET) && flags & LOG_OUTPUT_FLAG_FORMAT_SYSLOG) {
length = log_custom_timestamp_print(output, timestamp, print_formatted);
} else if (IS_ENABLED(CONFIG_LOG_BACKEND_NET) &&
flags & LOG_OUTPUT_FLAG_FORMAT_SYSLOG) {
#if defined(CONFIG_REQUIRES_FULL_LIBC) #if defined(CONFIG_REQUIRES_FULL_LIBC)
char time_str[sizeof("1970-01-01T00:00:00")]; char time_str[sizeof("1970-01-01T00:00:00")];
struct tm *tm; struct tm *tm;
@ -278,6 +275,8 @@ static int timestamp_print(const struct log_output *output,
date.year, date.month, date.day, date.year, date.month, date.day,
hours, mins, seconds, ms * 1000U + us); hours, mins, seconds, ms * 1000U + us);
#endif #endif
} else if (IS_ENABLED(CONFIG_LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP)) {
length = log_custom_timestamp_print(output, timestamp, print_formatted);
} else { } else {
if (IS_ENABLED(CONFIG_LOG_OUTPUT_FORMAT_LINUX_TIMESTAMP)) { if (IS_ENABLED(CONFIG_LOG_OUTPUT_FORMAT_LINUX_TIMESTAMP)) {
length = print_formatted(output, length = print_formatted(output,