AC_DEFINE_UNQUOTED([DLOG_SERVER_GROUP], "$dlog_server_group")
AC_SUBST([DLOG_SERVER_GROUP], "$dlog_server_group")
+critical_logfile_path_default=${localstatedir}/log/dlog/critical
+AC_ARG_ENABLE([critical-logfile],
+ AS_HELP_STRING([--critical-log-path=PATH], [path of the critical log file (default: $critical_logfile_path_default)]),
+ [critical_logfile=$enableval],
+ [critical_logfile=$critical_logfile_path_default])
+AC_DEFINE_UNQUOTED([DLOG_CRITICAL_LOGFILE_PATH], "$critical_logfile")
+AC_SUBST([DLOG_CRITICAL_LOGFILE_PATH], "$critical_logfile")
+
AC_ARG_ENABLE([android-monotonic],
AS_HELP_STRING([--enable-android-monotonic], [use monotonic send timestamp with log message when using android backend (EXPERIMENTAL)]),
[android_monotonic=true],
--enable-dynamic-filters
%endif
-make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\" -DDLOG_CRITICAL_LOGFILE=\"/var/log/dlog/critical\"'
+make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
# autoconf adds a bunch of flags, including -O2.
# Clear those so that test coverage can be measured properly
#include <stdlib.h>
#include <string.h>
-#ifndef DLOG_CRITICAL_LOGFILE
- #define DLOG_CRITICAL_LOGFILE "/var/log/dlog/critical"
-#endif
-
inline void close_fd(const int *fd) { if (*fd >= 0) close(*fd); }
int main (int argc, char **argv)
if (argc != 2) // Usage: ./dlog-log-critical "formatted message"
return EXIT_FAILURE;
- __attribute__((cleanup(close_fd))) const int fd = open(DLOG_CRITICAL_LOGFILE, O_WRONLY | O_APPEND | O_SYNC);
+ __attribute__((cleanup(close_fd))) const int fd = open(DLOG_CRITICAL_LOGFILE_PATH, O_WRONLY | O_APPEND | O_SYNC);
if (fd < 0)
return EXIT_FAILURE;