|
|
|
@ -198,43 +198,37 @@ extern int sc_log_module_initialized;
|
|
|
|
|
|
|
|
|
|
extern int sc_log_module_cleaned;
|
|
|
|
|
|
|
|
|
|
#define SCLog(x, ...) \
|
|
|
|
|
#define SCLog(x, file, func, line, ...) \
|
|
|
|
|
do { \
|
|
|
|
|
if (sc_log_global_log_level >= x && \
|
|
|
|
|
(sc_log_fg_filters_present == 0 || \
|
|
|
|
|
SCLogMatchFGFilterWL(__FILE__, __FUNCTION__, __LINE__) == 1 || \
|
|
|
|
|
SCLogMatchFGFilterBL(__FILE__, __FUNCTION__, __LINE__) == 1) && \
|
|
|
|
|
SCLogMatchFGFilterWL(file, func, line) == 1 || \
|
|
|
|
|
SCLogMatchFGFilterBL(file, func, line) == 1) && \
|
|
|
|
|
(sc_log_fd_filters_present == 0 || \
|
|
|
|
|
SCLogMatchFDFilter(__FUNCTION__) == 1)) \
|
|
|
|
|
SCLogMatchFDFilter(func) == 1)) \
|
|
|
|
|
{ \
|
|
|
|
|
char _sc_log_msg[SC_LOG_MAX_LOG_MSG_LEN]; \
|
|
|
|
|
\
|
|
|
|
|
snprintf(_sc_log_msg, SC_LOG_MAX_LOG_MSG_LEN, __VA_ARGS__); \
|
|
|
|
|
\
|
|
|
|
|
SCLogMessage(x, \
|
|
|
|
|
__FILE__, \
|
|
|
|
|
__LINE__, \
|
|
|
|
|
__FUNCTION__, SC_OK, _sc_log_msg); \
|
|
|
|
|
SCLogMessage(x, file, line, func, SC_OK, _sc_log_msg); \
|
|
|
|
|
} \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define SCLogErr(x, err, ...) \
|
|
|
|
|
#define SCLogErr(x, file, func, line, err, ...) \
|
|
|
|
|
do { \
|
|
|
|
|
if (sc_log_global_log_level >= x && \
|
|
|
|
|
(sc_log_fg_filters_present == 0 || \
|
|
|
|
|
SCLogMatchFGFilterWL(__FILE__, __FUNCTION__, __LINE__) == 1 || \
|
|
|
|
|
SCLogMatchFGFilterBL(__FILE__, __FUNCTION__, __LINE__) == 1) && \
|
|
|
|
|
SCLogMatchFGFilterWL(file, func, line) == 1 || \
|
|
|
|
|
SCLogMatchFGFilterBL(file, func, line) == 1) && \
|
|
|
|
|
(sc_log_fd_filters_present == 0 || \
|
|
|
|
|
SCLogMatchFDFilter(__FUNCTION__) == 1)) \
|
|
|
|
|
SCLogMatchFDFilter(func) == 1)) \
|
|
|
|
|
{ \
|
|
|
|
|
char _sc_log_msg[SC_LOG_MAX_LOG_MSG_LEN]; \
|
|
|
|
|
\
|
|
|
|
|
snprintf(_sc_log_msg, SC_LOG_MAX_LOG_MSG_LEN, __VA_ARGS__); \
|
|
|
|
|
\
|
|
|
|
|
SCLogMessage(x, \
|
|
|
|
|
__FILE__, \
|
|
|
|
|
__LINE__, \
|
|
|
|
|
__FUNCTION__, err, _sc_log_msg); \
|
|
|
|
|
SCLogMessage(x, file, line, func, err, _sc_log_msg); \
|
|
|
|
|
} \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
@ -243,14 +237,20 @@ extern int sc_log_module_cleaned;
|
|
|
|
|
*
|
|
|
|
|
* \retval ... Takes as argument(s), a printf style format message
|
|
|
|
|
*/
|
|
|
|
|
#define SCLogInfo(...) SCLog(SC_LOG_INFO, __VA_ARGS__)
|
|
|
|
|
#define SCLogInfo(...) SCLog(SC_LOG_INFO, \
|
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
|
|
|
|
|
#define SCLogInfoRaw(file, func, line, ...) SCLog(SC_LOG_INFO, \
|
|
|
|
|
(file), (func), (line), __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Macro used to log NOTICE messages.
|
|
|
|
|
*
|
|
|
|
|
* \retval ... Takes as argument(s), a printf style format message
|
|
|
|
|
*/
|
|
|
|
|
#define SCLogNotice(...) SCLog(SC_LOG_NOTICE, __VA_ARGS__)
|
|
|
|
|
#define SCLogNotice(...) SCLog(SC_LOG_NOTICE, \
|
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
|
|
|
|
|
#define SCLogNoticeRaw(file, func, line, ... ) SCLog(SC_LOG_NOTICE, \
|
|
|
|
|
(file), (func), (line), __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Macro used to log WARNING messages.
|
|
|
|
@ -259,8 +259,12 @@ extern int sc_log_module_cleaned;
|
|
|
|
|
* warning message
|
|
|
|
|
* \retval ... Takes as argument(s), a printf style format message
|
|
|
|
|
*/
|
|
|
|
|
#define SCLogWarning(err_code, ...) SCLogErr(SC_LOG_WARNING, err_code, \
|
|
|
|
|
__VA_ARGS__)
|
|
|
|
|
#define SCLogWarning(err_code, ...) SCLogErr(SC_LOG_WARNING, \
|
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
|
err_code, __VA_ARGS__)
|
|
|
|
|
#define SCLogWarningRaw(err_code, file, func, line, ...) \
|
|
|
|
|
SCLogErr(SC_LOG_WARNING, (file), (func), (line), err_code, __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Macro used to log ERROR messages.
|
|
|
|
|
*
|
|
|
|
@ -268,8 +272,12 @@ extern int sc_log_module_cleaned;
|
|
|
|
|
* error message
|
|
|
|
|
* \retval ... Takes as argument(s), a printf style format message
|
|
|
|
|
*/
|
|
|
|
|
#define SCLogError(err_code, ...) SCLogErr(SC_LOG_ERROR, err_code, \
|
|
|
|
|
__VA_ARGS__)
|
|
|
|
|
#define SCLogError(err_code, ...) SCLogErr(SC_LOG_ERROR, \
|
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
|
err_code, __VA_ARGS__)
|
|
|
|
|
#define SCLogErrorRaw(err_code, file, func, line, ...) SCLogErr(SC_LOG_ERROR, \
|
|
|
|
|
(file), (func), (line), err_code, __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Macro used to log CRITICAL messages.
|
|
|
|
|
*
|
|
|
|
@ -277,8 +285,9 @@ extern int sc_log_module_cleaned;
|
|
|
|
|
* critical message
|
|
|
|
|
* \retval ... Takes as argument(s), a printf style format message
|
|
|
|
|
*/
|
|
|
|
|
#define SCLogCritical(err_code, ...) SCLogErr(SC_LOG_CRITICAL, err_code, \
|
|
|
|
|
__VA_ARGS__)
|
|
|
|
|
#define SCLogCritical(err_code, ...) SCLogErr(SC_LOG_CRITICAL, \
|
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
|
err_code, __VA_ARGS__)
|
|
|
|
|
/**
|
|
|
|
|
* \brief Macro used to log ALERT messages.
|
|
|
|
|
*
|
|
|
|
@ -286,8 +295,9 @@ extern int sc_log_module_cleaned;
|
|
|
|
|
* alert message
|
|
|
|
|
* \retval ... Takes as argument(s), a printf style format message
|
|
|
|
|
*/
|
|
|
|
|
#define SCLogAlert(err_code, ...) SCLogErr(SC_LOG_ALERT, err_code, \
|
|
|
|
|
__VA_ARGS__)
|
|
|
|
|
#define SCLogAlert(err_code, ...) SCLogErr(SC_LOG_ALERT, \
|
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
|
err_code, __VA_ARGS__)
|
|
|
|
|
/**
|
|
|
|
|
* \brief Macro used to log EMERGENCY messages.
|
|
|
|
|
*
|
|
|
|
@ -295,8 +305,9 @@ extern int sc_log_module_cleaned;
|
|
|
|
|
* emergency message
|
|
|
|
|
* \retval ... Takes as argument(s), a printf style format message
|
|
|
|
|
*/
|
|
|
|
|
#define SCLogEmerg(err_code, ...) SCLogErr(SC_LOG_EMERGENCY, err_code, \
|
|
|
|
|
__VA_ARGS__)
|
|
|
|
|
#define SCLogEmerg(err_code, ...) SCLogErr(SC_LOG_EMERGENCY, \
|
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
|
err_code, __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Avoid the overhead of using the debugging subsystem, in production mode */
|
|
|
|
@ -332,7 +343,7 @@ extern int sc_log_module_cleaned;
|
|
|
|
|
*
|
|
|
|
|
* \retval ... Takes as argument(s), a printf style format message
|
|
|
|
|
*/
|
|
|
|
|
#define SCLogDebug(...) SCLog(SC_LOG_DEBUG, __VA_ARGS__)
|
|
|
|
|
#define SCLogDebug(...) SCLog(SC_LOG_DEBUG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Macro used to log debug messages on function entry. Comes under the
|
|
|
|
|