From 5b80a4c92c9aa9ef45ce1da599b401ba631a86ed Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Wed, 5 Oct 2022 10:32:15 +0200 Subject: internal-logging: Fix issues with file logging (#378) This commit fixes the following issues if access to the internal log file is not possible (logging_mode = DLT_LOG_TO_FILE) * dlt_log_free tried to call fclose on a nullptr Added a nullcheck for this * Access to log file might be denied but access to logs is still wanted Add a new CMake option WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK If this is set to ON and the logging moe is set to file, the dlt-daemon will fall back to syslog if opening the internal log file failed Signed-off-by: Alexander Mohr --- include/dlt/dlt_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h index 9a99fce..100a481 100644 --- a/include/dlt/dlt_common.h +++ b/include/dlt/dlt_common.h @@ -1195,7 +1195,7 @@ void dlt_print_with_attributes(bool state); * Initialize (external) logging facility * @param mode positive, 0 = log to stdout, 1 = log to syslog, 2 = log to file, 3 = log to stderr */ -void dlt_log_init(int mode); +DltReturnValue dlt_log_init(int mode); /** * Print with variable arguments to specified file descriptor by DLT_LOG_MODE environment variable (like fprintf) * @param format format string for message -- cgit v1.2.1