Logging module optimization changes

remotes/origin/master-1.0.x
Anoop Saldanha 17 years ago committed by Victor Julien
parent ff018d4b43
commit bc42aebdd5

@ -18,6 +18,12 @@
extern int sc_log_module_initialized;
extern int sc_log_module_cleaned;
/* used to indicate if any FG filters are registered */
int sc_log_fg_filters_present = 0;
/* used to indicate if any FD filters are registered */
int sc_log_fd_filters_present = 0;
/**
* \brief Holds the fine-grained filters
*/
@ -306,6 +312,8 @@ static inline int SCLogAddFGFilter(const char *file, const char *function,
done:
mutex_unlock(&sc_log_fg_filters_m[listtype]);
sc_log_fg_filters_present = 1;
return 0;
}
@ -860,6 +868,7 @@ int SCLogAddFDFilter(const char *function)
}
mutex_unlock(&sc_log_fd_filters_m);
sc_log_fd_filters_present = 1;
return 0;
}
@ -943,6 +952,9 @@ int SCLogRemoveFDFilter(const char *function)
mutex_unlock(&sc_log_fd_filters_m);
if (sc_log_fd_filters == NULL)
sc_log_fd_filters_present = 0;
return 0;
}

@ -66,6 +66,12 @@ typedef struct SCLogFDFilter_ {
struct SCLogFDFilter_ *next;
} SCLogFDFilter;
extern int sc_log_fg_filters_present;
extern int sc_log_fd_filters_present;
int SCLogAddFGFilterWL(const char *, const char *, int);
int SCLogAddFGFilterBL(const char *, const char *, int);

@ -274,13 +274,15 @@ SCError SCLogMessage(SCLogLevel log_level, char **msg, const char *file,
return SC_LOG_MODULE_NOT_INIT;
}
if (sc_log_fg_filters_present == 1) {
if (SCLogMatchFGFilterWL(file, function, line) != 1)
return SC_LOG_FG_FILTER_MATCH_FAILED;
if (SCLogMatchFGFilterBL(file, function, line) != 1)
return SC_LOG_FG_FILTER_MATCH_FAILED;
}
if (SCLogMatchFDFilter(function) != 1)
if (sc_log_fd_filters_present == 1 && SCLogMatchFDFilter(function) != 1)
return SC_LOG_FG_FILTER_MATCH_FAILED;
while ( (temp_fmt = index(temp_fmt, SC_LOG_FMT_PREFIX)) ) {

Loading…
Cancel
Save