-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2020 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
return;
}
+static inline const char *SCLogGetDefaultLogFormat(void)
+{
+ const char *prog_ver = GetProgramVersion();
+ if (strstr(prog_ver, "RELEASE") != NULL) {
+ return SC_LOG_DEF_LOG_FORMAT_REL;
+ }
+ return SC_LOG_DEF_LOG_FORMAT_DEV;
+}
+
/**
* \brief Internal function used to set the logging module global_log_format
* during the initialization phase
/* deal with the global log format to be used */
if (format == NULL || strlen(format) > SC_LOG_MAX_LOG_FORMAT_LEN) {
- format = SC_LOG_DEF_LOG_FORMAT;
+ format = SCLogGetDefaultLogFormat();
#ifndef UNITTESTS
if (sc_lid != NULL) {
printf("Warning: Invalid/No global_log_format supplied by user or format "
}
if (ConfGet("logging.default-log-format", &sc_lid->global_log_format) != 1)
- sc_lid->global_log_format = SC_LOG_DEF_LOG_FORMAT;
+ sc_lid->global_log_format = SCLogGetDefaultLogFormat();
(void)ConfGet("logging.default-output-filter", &sc_lid->op_filter);
FAIL_IF_NOT(sc_log_config->op_ifaces != NULL &&
SC_LOG_DEF_LOG_OP_IFACE == sc_log_config->op_ifaces->iface);
FAIL_IF_NOT(sc_log_config->log_format != NULL &&
- strcmp(SC_LOG_DEF_LOG_FORMAT, sc_log_config->log_format) == 0);
+ strcmp(SCLogGetDefaultLogFormat(), sc_log_config->log_format) == 0);
SCLogDeInitLogModule();
sc_log_config->op_ifaces->next != NULL &&
SC_LOG_OP_IFACE_CONSOLE == sc_log_config->op_ifaces->next->iface);
FAIL_IF_NOT(sc_log_config->log_format != NULL &&
- strcmp(SC_LOG_DEF_LOG_FORMAT, sc_log_config->log_format) == 0);
+ strcmp(SCLogGetDefaultLogFormat(), sc_log_config->log_format) == 0);
FAIL_IF_NOT(sc_log_config->op_ifaces != NULL &&
sc_log_config->op_ifaces->log_format != NULL &&
strcmp("%m - %d", sc_log_config->op_ifaces->log_format) == 0);
} SCLogOPType;
/* The default log_format, if it is not supplied by the user */
-#ifdef RELEASE
-#define SC_LOG_DEF_LOG_FORMAT "%t - <%d> - "
-#else
-#define SC_LOG_DEF_LOG_FORMAT "[%i] %t - (%f:%l) <%d> (%n) -- "
-#endif
+#define SC_LOG_DEF_LOG_FORMAT_REL "%t - <%d> - "
+#define SC_LOG_DEF_LOG_FORMAT_DEV "[%i] %t - (%f:%l) <%d> (%n) -- "
/* The maximum length of the log message */
#define SC_LOG_MAX_LOG_MSG_LEN 2048