Cynara plugins include log.h in its interface, making log.h header
visible to external modules that implement plugins. Such change
was introduced to Cynara when log.h implemented only one kind of logger (journal).
Today, this file can alternatively compile to use syslog, journal or dlog,
depending on definitions passed from spec/cmake. This causes external modules
to rely on Cynara's internal macros, not defined in their cmake files.
This commit returns back "feature" of log.h to compile to syslog usage
as it was prior 0.14.15 release, in order to fix external module build breaks,
introduced by commit
632d8296266547f2291e03149e54fbc399bd9de8.
Ideally, this problem requires more changes - changing logging in dependent
modules not to use Cynara's loging definitions from log.h & removing log.h from API.
However, Since Cynara is an open source project and may be used outside Tizen, this change is
introduced first - modifying API should be done with careful consideration for external users.
Change-Id: I99c80ceb636fd9797b2419eb87b81171351b95f3
IF (LOG_TYPE MATCHES "JOURNAL")
ADD_DEFINITIONS("-DBUILD_WITH_SYSTEMD_JOURNAL")
-ELSEIF (LOG_TYPE MATCHES "SYSLOG")
- ADD_DEFINITIONS("-DBUILD_WITH_SYSLOG")
ELSEIF (LOG_TYPE MATCHES "DLOG")
ADD_DEFINITIONS("-DBUILD_WITH_DLOG")
ELSEIF (LOG_TYPE MATCHES "NONE")
ADD_DEFINITIONS("-DCYNARA_NO_LOGS")
+ELSEIF (LOG_TYPE MATCHES "SYSLOG")
+ MESSAGE(STATUS "Using syslog - no additional definition needed")
ELSE ()
- MESSAGE(FATAL_ERROR "Unsupported logging mechanism")
+ MESSAGE(FATAL_ERROR "No logging option specified")
ENDIF ()
IF (BUILD_SERVICE)
#include <sstream>
#ifdef BUILD_WITH_SYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
-#elif defined(BUILD_WITH_SYSLOG)
-#include <syslog.h>
#elif defined(BUILD_WITH_DLOG)
#include "DlogLog.h"
+#else
+#include <syslog.h>
#endif
#endif // CYNARA_NO_LOGS
sd_journal_print(level, std::forward<Args>(args)...);
#elif defined(BUILD_WITH_DLOG)
cynara_dlog_print(level, std::forward<Args>(args)...);
-#elif defined(BUILD_WITH_SYSLOG)
+#else
syslog(level, std::forward<Args>(args)...);
#endif
}