suricata
util-debug.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2010 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Anoop Saldanha <anoopsaldanha@gmail.com>
22  */
23 
24 #ifndef __UTIL_DEBUG_H__
25 #define __UTIL_DEBUG_H__
26 
27 #include <stdio.h>
28 #include <stdint.h>
29 #include <pcre.h>
30 
31 #include "threads.h"
32 #include "util-enum.h"
33 #include "util-error.h"
34 #include "util-debug-filters.h"
35 
36 /**
37  * \brief ENV vars that can be used to set the properties for the logging module
38  */
39 #define SC_LOG_ENV_LOG_LEVEL "SC_LOG_LEVEL"
40 #define SC_LOG_ENV_LOG_OP_IFACE "SC_LOG_OP_IFACE"
41 #define SC_LOG_ENV_LOG_FILE "SC_LOG_FILE"
42 #define SC_LOG_ENV_LOG_FACILITY "SC_LOG_FACILITY"
43 #define SC_LOG_ENV_LOG_FORMAT "SC_LOG_FORMAT"
44 #define SC_LOG_ENV_LOG_OP_FILTER "SC_LOG_OP_FILTER"
45 
46 /**
47  * \brief The various log levels
48  * NOTE: when adding new level, don't forget to update SCLogMapLogLevelToSyslogLevel()
49  * or it may result in logging to syslog with LOG_EMERG priority.
50  */
51 typedef enum {
65 } SCLogLevel;
66 
67 /**
68  * \brief The various output interfaces supported
69  */
70 typedef enum {
75 } SCLogOPIface;
76 
77 typedef enum {
80 } SCLogOPType;
81 
82 /* The default log_format, if it is not supplied by the user */
83 #ifdef RELEASE
84 #define SC_LOG_DEF_LOG_FORMAT "%t - <%d> - "
85 #else
86 #define SC_LOG_DEF_LOG_FORMAT "[%i] %t - (%f:%l) <%d> (%n) -- "
87 #endif
88 
89 /* The maximum length of the log message */
90 #define SC_LOG_MAX_LOG_MSG_LEN 2048
91 
92 /* The maximum length of the log format */
93 #define SC_LOG_MAX_LOG_FORMAT_LEN 128
94 
95 /* The default log level, if it is not supplied by the user */
96 #define SC_LOG_DEF_LOG_LEVEL SC_LOG_INFO
97 
98 /* The default output interface to be used */
99 #define SC_LOG_DEF_LOG_OP_IFACE SC_LOG_OP_IFACE_CONSOLE
100 
101 /* The default log file to be used */
102 #define SC_LOG_DEF_LOG_FILE "suricata.log"
103 
104 /* The default syslog facility to be used */
105 #define SC_LOG_DEF_SYSLOG_FACILITY_STR "local0"
106 #define SC_LOG_DEF_SYSLOG_FACILITY LOG_LOCAL0
107 
108 /**
109  * \brief Structure to be used when log_level override support would be provided
110  * by the logging module
111  */
112 typedef struct SCLogOPBuffer_ {
114  char *temp;
115  const char *log_format;
116 } SCLogOPBuffer;
117 
118 /**
119  * \brief The output interface context for the logging module
120  */
121 typedef struct SCLogOPIfaceCtx_ {
123 
124  int16_t use_color;
125  int16_t type;
126 
127  /* the output file to be used if the interface is SC_LOG_IFACE_FILE */
128  const char *file;
129  /* the output file descriptor for the above file */
130  FILE * file_d;
131 
132  /* registered to be set on a file rotation signal */
134 
135  /* the facility code if the interface is SC_LOG_IFACE_SYSLOG */
136  int facility;
137 
138  /* override for the global_log_level */
140 
141  /* override for the global_log_format(currently not used) */
142  const char *log_format;
143 
144  /* Mutex used for locking around rotate/write to a file. */
146 
149 
150 /**
151  * \brief Structure containing init data, that would be passed to
152  * SCInitDebugModule()
153  */
154 typedef struct SCLogInitData_ {
155  /* startup message */
156  const char *startup_message;
157 
158  /* the log level */
160 
161  /* the log format */
162  const char *global_log_format;
163 
164  /* output filter */
165  const char *op_filter;
166 
167  /* list of output interfaces to be used */
169  /* no of op ifaces */
170  uint8_t op_ifaces_cnt;
171 } SCLogInitData;
172 
173 /**
174  * \brief Holds the config state used by the logging api
175  */
176 typedef struct SCLogConfig_ {
179  char *log_format;
180 
181  char *op_filter;
182  /* compiled pcre filter expression */
185 
186  /* op ifaces used */
188  /* no of op ifaces */
189  uint8_t op_ifaces_cnt;
190 } SCLogConfig;
191 
192 /* The different log format specifiers supported by the API */
193 #define SC_LOG_FMT_TIME 't' /* Timestamp in standard format */
194 #define SC_LOG_FMT_PID 'p' /* PID */
195 #define SC_LOG_FMT_TID 'i' /* Thread ID */
196 #define SC_LOG_FMT_TM 'm' /* Thread module name */
197 #define SC_LOG_FMT_LOG_LEVEL 'd' /* Log level */
198 #define SC_LOG_FMT_FILE_NAME 'f' /* File name */
199 #define SC_LOG_FMT_LINE 'l' /* Line number */
200 #define SC_LOG_FMT_FUNCTION 'n' /* Function */
201 
202 /* The log format prefix for the format specifiers */
203 #define SC_LOG_FMT_PREFIX '%'
204 
206 
207 extern int sc_log_module_initialized;
208 
209 extern int sc_log_module_cleaned;
210 
211 #define SCLog(x, file, func, line, ...) \
212  do { \
213  if (sc_log_global_log_level >= x && \
214  (sc_log_fg_filters_present == 0 || \
215  SCLogMatchFGFilterWL(file, func, line) == 1 || \
216  SCLogMatchFGFilterBL(file, func, line) == 1) && \
217  (sc_log_fd_filters_present == 0 || \
218  SCLogMatchFDFilter(func) == 1)) \
219  { \
220  char _sc_log_msg[SC_LOG_MAX_LOG_MSG_LEN]; \
221  \
222  int _sc_log_ret = snprintf(_sc_log_msg, SC_LOG_MAX_LOG_MSG_LEN, __VA_ARGS__); \
223  if (_sc_log_ret == SC_LOG_MAX_LOG_MSG_LEN) \
224  _sc_log_msg[SC_LOG_MAX_LOG_MSG_LEN - 1] = '\0'; \
225  \
226  SCLogMessage(x, file, line, func, SC_OK, _sc_log_msg); \
227  } \
228  } while(0)
229 
230 #define SCLogErr(x, file, func, line, err, ...) \
231  do { \
232  if (sc_log_global_log_level >= x && \
233  (sc_log_fg_filters_present == 0 || \
234  SCLogMatchFGFilterWL(file, func, line) == 1 || \
235  SCLogMatchFGFilterBL(file, func, line) == 1) && \
236  (sc_log_fd_filters_present == 0 || \
237  SCLogMatchFDFilter(func) == 1)) \
238  { \
239  char _sc_log_msg[SC_LOG_MAX_LOG_MSG_LEN]; \
240  \
241  int _sc_log_ret = snprintf(_sc_log_msg, SC_LOG_MAX_LOG_MSG_LEN, __VA_ARGS__); \
242  if (_sc_log_ret == SC_LOG_MAX_LOG_MSG_LEN) \
243  _sc_log_msg[SC_LOG_MAX_LOG_MSG_LEN - 1] = '\0'; \
244  \
245  SCLogMessage(x, file, line, func, err, _sc_log_msg); \
246  } \
247  } while(0)
248 
249 /**
250  * \brief Macro used to log INFORMATIONAL messages.
251  *
252  * \retval ... Takes as argument(s), a printf style format message
253  */
254 #define SCLogInfo(...) SCLog(SC_LOG_INFO, \
255  __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
256 #define SCLogInfoRaw(file, func, line, ...) SCLog(SC_LOG_INFO, \
257  (file), (func), (line), __VA_ARGS__)
258 
259 #define SCLogConfig(...) SCLog(SC_LOG_CONFIG, \
260  __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
261 #define SCLogPerf(...) SCLog(SC_LOG_PERF, \
262  __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
263 
264 /**
265  * \brief Macro used to log NOTICE messages.
266  *
267  * \retval ... Takes as argument(s), a printf style format message
268  */
269 #define SCLogNotice(...) SCLog(SC_LOG_NOTICE, \
270  __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
271 #define SCLogNoticeRaw(file, func, line, ... ) SCLog(SC_LOG_NOTICE, \
272  (file), (func), (line), __VA_ARGS__)
273 
274 /**
275  * \brief Macro used to log WARNING messages.
276  *
277  * \retval err_code Error code that has to be logged along with the
278  * warning message
279  * \retval ... Takes as argument(s), a printf style format message
280  */
281 #define SCLogWarning(err_code, ...) SCLogErr(SC_LOG_WARNING, \
282  __FILE__, __FUNCTION__, __LINE__, \
283  err_code, __VA_ARGS__)
284 #define SCLogWarningRaw(err_code, file, func, line, ...) \
285  SCLogErr(SC_LOG_WARNING, (file), (func), (line), err_code, __VA_ARGS__)
286 
287 /**
288  * \brief Macro used to log ERROR messages.
289  *
290  * \retval err_code Error code that has to be logged along with the
291  * error message
292  * \retval ... Takes as argument(s), a printf style format message
293  */
294 #define SCLogError(err_code, ...) SCLogErr(SC_LOG_ERROR, \
295  __FILE__, __FUNCTION__, __LINE__, \
296  err_code, __VA_ARGS__)
297 #define SCLogErrorRaw(err_code, file, func, line, ...) SCLogErr(SC_LOG_ERROR, \
298  (file), (func), (line), err_code, __VA_ARGS__)
299 
300 /**
301  * \brief Macro used to log CRITICAL messages.
302  *
303  * \retval err_code Error code that has to be logged along with the
304  * critical message
305  * \retval ... Takes as argument(s), a printf style format message
306  */
307 #define SCLogCritical(err_code, ...) SCLogErr(SC_LOG_CRITICAL, \
308  __FILE__, __FUNCTION__, __LINE__, \
309  err_code, __VA_ARGS__)
310 /**
311  * \brief Macro used to log ALERT messages.
312  *
313  * \retval err_code Error code that has to be logged along with the
314  * alert message
315  * \retval ... Takes as argument(s), a printf style format message
316  */
317 #define SCLogAlert(err_code, ...) SCLogErr(SC_LOG_ALERT, \
318  __FILE__, __FUNCTION__, __LINE__, \
319  err_code, __VA_ARGS__)
320 /**
321  * \brief Macro used to log EMERGENCY messages.
322  *
323  * \retval err_code Error code that has to be logged along with the
324  * emergency message
325  * \retval ... Takes as argument(s), a printf style format message
326  */
327 #define SCLogEmerg(err_code, ...) SCLogErr(SC_LOG_EMERGENCY, \
328  __FILE__, __FUNCTION__, __LINE__, \
329  err_code, __VA_ARGS__)
330 
331 
332 /* Avoid the overhead of using the debugging subsystem, in production mode */
333 #ifndef DEBUG
334 
335 #define SCLogDebug(...) do { } while (0)
336 
337 #define SCEnter(...)
338 
339 #define SCReturn return
340 
341 #define SCReturnInt(x) return x
342 
343 #define SCReturnUInt(x) return x
344 
345 #define SCReturnDbl(x) return x
346 
347 #define SCReturnChar(x) return x
348 
349 #define SCReturnCharPtr(x) return x
350 
351 #define SCReturnCT(x, type) return x
352 
353 #define SCReturnPtr(x, type) return x
354 
355 #define SCReturnBool(x) return x
356 
357 /* Please use it only for debugging purposes */
358 #else
359 
360 
361 /**
362  * \brief Macro used to log DEBUG messages. Comes under the debugging subsystem,
363  * and hence will be enabled only in the presence of the DEBUG macro.
364  *
365  * \retval ... Takes as argument(s), a printf style format message
366  */
367 #define SCLogDebug(...) SCLog(SC_LOG_DEBUG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
368 
369 /**
370  * \brief Macro used to log debug messages on function entry. Comes under the
371  * debugging subsystem, and hence will be enabled only in the presence
372  * of the DEBUG macro. Apart from logging function_entry logs, it also
373  * processes the FD filters, if any FD filters are registered.
374  *
375  * \retval f An argument can be supplied, although it is not used
376  */
377 #define SCEnter(f) do { \
378  if (sc_log_global_log_level >= SC_LOG_DEBUG &&\
379  SCLogCheckFDFilterEntry(__FUNCTION__)) \
380  { \
381  SCLogDebug("Entering ... >>"); \
382  } \
383  } while(0)
384 
385 
386 /**
387  * \brief Macro used to log debug messages on function exit. Comes under the
388  * debugging sybsystem, and hence will be enabled only in the presence
389  * of the DEBUG macro. Apart from logging function_exit logs, it also
390  * processes the FD filters, if any FD filters are registered. This
391  * function_exit macro should be used for functions that don't return
392  * a value.
393  */
394 #define SCReturn do { \
395  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
396  SCLogDebug("Returning ... <<" ); \
397  SCLogCheckFDFilterExit(__FUNCTION__); \
398  } \
399  return; \
400  } while(0)
401 
402 /**
403  * \brief Macro used to log debug messages on function exit. Comes under the
404  * debugging sybsystem, and hence will be enabled only in the presence
405  * of the DEBUG macro. Apart from logging function_exit logs, it also
406  * processes the FD filters, if any FD filters are registered. This
407  * function_exit macro should be used for functions that returns an
408  * integer value.
409  *
410  * \retval x Variable of type 'integer' that has to be returned
411  */
412 #define SCReturnInt(x) do { \
413  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
414  SCLogDebug("Returning: %"PRIdMAX" ... <<", (intmax_t)x); \
415  SCLogCheckFDFilterExit(__FUNCTION__); \
416  } \
417  return x; \
418  } while(0)
419 
420 /**
421  * \brief Macro used to log debug messages on function exit. Comes under the
422  * debugging sybsystem, and hence will be enabled only in the presence
423  * of the DEBUG macro. Apart from logging function_exit logs, it also
424  * processes the FD filters, if any FD filters are registered. This
425  * function_exit macro should be used for functions that returns an
426  * unsigned integer value.
427  *
428  * \retval x Variable of type 'unsigned integer' that has to be returned
429  */
430 #define SCReturnUInt(x) do { \
431  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
432  SCLogDebug("Returning: %"PRIuMAX" ... <<", (uintmax_t)x); \
433  SCLogCheckFDFilterExit(__FUNCTION__); \
434  } \
435  return x; \
436  } while(0)
437 
438 /**
439  * \brief Macro used to log debug messages on function exit. Comes under the
440  * debugging sybsystem, and hence will be enabled only in the presence
441  * of the DEBUG macro. Apart from logging function_exit logs, it also
442  * processes the FD filters, if any FD filters are registered. This
443  * function_exit macro should be used for functions that returns a
444  * float/double value.
445  *
446  * \retval x Variable of type 'float/double' that has to be returned
447  */
448 #define SCReturnDbl(x) do { \
449  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
450  SCLogDebug("Returning: %f ... <<", x); \
451  SCLogCheckFDFilterExit(__FUNCTION__); \
452  } \
453  return x; \
454  } while(0)
455 
456 /**
457  * \brief Macro used to log debug messages on function exit. Comes under the
458  * debugging sybsystem, and hence will be enabled only in the presence
459  * of the DEBUG macro. Apart from logging function_exit logs, it also
460  * processes the FD filters, if any FD filters are registered. This
461  * function_exit macro should be used for functions that returns a var
462  * of character type.
463  *
464  * \retval x Variable of type 'char' that has to be returned
465  */
466 #define SCReturnChar(x) do { \
467  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
468  SCLogDebug("Returning: %c ... <<", x); \
469  SCLogCheckFDFilterExit(__FUNCTION__); \
470  } \
471  return x; \
472  } while(0)
473 
474 /**
475  * \brief Macro used to log debug messages on function exit. Comes under the
476  * debugging sybsystem, and hence will be enabled only in the presence
477  * of the DEBUG macro. Apart from logging function_exit logs, it also
478  * processes the FD filters, if any FD filters are registered. This
479  * function_exit macro should be used for functions that returns a
480  * character string.
481  *
482  * \retval x Pointer to the char string that has to be returned
483  */
484 #define SCReturnCharPtr(x) do { \
485  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
486  if ((x) != NULL) { \
487  SCLogDebug("Returning: %s ... <<", x); \
488  } else { \
489  SCLogDebug("Returning: NULL ... <<"); \
490  } SCLogCheckFDFilterExit(__FUNCTION__); \
491  } \
492  return x; \
493  } while(0)
494 
495 
496 /**
497  * \brief Macro used to log debug messages on function exit. Comes under the
498  * debugging sybsystem, and hence will be enabled only in the presence
499  * of the DEBUG macro. Apart from logging function_exit logs, it also
500  * processes the FD filters, if any FD filters are registered. This
501  * function_exit macro should be used for functions that returns a var
502  * of custom type
503  *
504  * \retval x Variable instance of a custom type that has to be returned
505  * \retval type Pointer to a character string holding the name of the custom
506  * type(the argument x) that has to be returned
507  */
508 #define SCReturnCT(x, type) do { \
509  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
510  SCLogDebug("Returning var of " \
511  "type %s ... <<", type); \
512  SCLogCheckFDFilterExit(__FUNCTION__); \
513  } \
514  return x; \
515  } while(0)
516 
517 /**
518  * \brief Macro used to log debug messages on function exit. Comes under the
519  * debugging sybsystem, and hence will be enabled only in the presence
520  * of the DEBUG macro. Apart from logging function_exit logs, it also
521  * processes the FD filters, if any FD filters are registered. This
522  * function_exit macro should be used for functions that returns a
523  * pointer to a custom type
524  *
525  * \retval x Pointer to a variable instance of a custom type that has to be
526  * returned
527  * \retval type Pointer to a character string holding the name of the custom
528  * type(the argument x) that has to be returned
529  */
530 #define SCReturnPtr(x, type) do { \
531  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
532  SCLogDebug("Returning pointer %p of " \
533  "type %s ... <<", x, type); \
534  SCLogCheckFDFilterExit(__FUNCTION__); \
535  } \
536  return x; \
537  } while(0)
538 
539 /**
540  * \brief Macro used to log debug messages on function exit. Comes under the
541  * debugging sybsystem, and hence will be enabled only in the presence
542  * of the DEBUG macro. Apart from logging function_exit logs, it also
543  * processes the FD filters, if any FD filters are registered. This
544  * function_exit macro should be used for functions that returns a
545  * boolean value.
546  *
547  * \retval x Variable of type 'bool' that has to be returned
548  */
549 #define SCReturnBool(x) do { \
550  if (sc_log_global_log_level >= SC_LOG_DEBUG) { \
551  SCLogDebug("Returning: %s ... <<", x ? "true" : "false"); \
552  SCLogCheckFDFilterExit(__FUNCTION__); \
553  } \
554  return x; \
555  } while(0)
556 
557 #endif /* DEBUG */
558 
559 #define FatalError(x, ...) do { \
560  SCLogError(x, __VA_ARGS__); \
561  exit(EXIT_FAILURE); \
562 } while(0)
563 
564 /** \brief Fatal error IF we're starting up, and configured to consider
565  * errors to be fatal errors */
566 #if !defined(__clang_analyzer__)
567 #define FatalErrorOnInit(x, ...) do { \
568  int init_errors_fatal = 0; \
569  ConfGetBool("engine.init-failure-fatal", &init_errors_fatal); \
570  if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT))\
571  { \
572  SCLogError(x, __VA_ARGS__); \
573  exit(EXIT_FAILURE); \
574  } \
575  SCLogWarning(x, __VA_ARGS__); \
576 } while(0)
577 /* make it simpler for scan-build */
578 #else
579 #define FatalErrorOnInit(x, ...) FatalError(x, __VA_ARGS__)
580 #endif
581 
583 
584 SCLogOPIfaceCtx *SCLogInitOPIfaceCtx(const char *, const char *, int,
585  const char *);
586 
588 
590 
591 void SCLogDeInitLogModule(void);
592 
593 SCError SCLogMessage(const SCLogLevel, const char *, const unsigned int,
594  const char *, const SCError, const char *message);
595 
597 
598 int SCLogDebugEnabled(void);
599 
600 void SCLogRegisterTests(void);
601 
602 void SCLogLoadConfig(int daemon, int verbose);
603 
604 #endif /* __UTIL_DEBUG_H__ */
#define SCMutex
uint8_t op_ifaces_cnt
Definition: util-debug.h:189
SCLogOPIfaceCtx * SCLogInitOPIfaceCtx(const char *, const char *, int, const char *)
Creates a new output interface based on the arguments sent. The kind of output interface to be create...
Definition: util-debug.c:1212
SCLogLevel log_level
Definition: util-debug.h:178
void SCLogLoadConfig(int daemon, int verbose)
Definition: util-debug.c:1286
const char * log_format
Definition: util-debug.h:142
SCLogLevel global_log_level
Definition: util-debug.h:159
SCLogOPIface
The various output interfaces supported.
Definition: util-debug.h:70
int sc_log_module_initialized
Used to indicate whether the logging module has been init or not.
Definition: util-debug.c:100
Holds the config state used by the logging api.
Definition: util-debug.h:176
char * log_format
Definition: util-debug.h:179
#define SC_LOG_MAX_LOG_MSG_LEN
Definition: util-debug.h:90
struct SCLogOPBuffer_ SCLogOPBuffer
Structure to be used when log_level override support would be provided by the logging module...
const char * startup_message
Definition: util-debug.h:156
const char * op_filter
Definition: util-debug.h:165
SCLogOPIface iface
Definition: util-debug.h:122
SCLogInitData * SCLogAllocLogInitData(void)
Returns a pointer to a new SCLogInitData. This is a public interface intended to be used after the lo...
Definition: util-debug.c:1104
int16_t use_color
Definition: util-debug.h:124
Structure to be used when log_level override support would be provided by the logging module...
Definition: util-debug.h:112
SCLogOPIfaceCtx * op_ifaces
Definition: util-debug.h:168
SCLogLevel
The various log levels NOTE: when adding new level, don&#39;t forget to update SCLogMapLogLevelToSyslogLe...
Definition: util-debug.h:51
char * startup_message
Definition: util-debug.h:177
uint8_t op_ifaces_cnt
Definition: util-debug.h:170
const char * file
Definition: util-debug.h:128
Structure containing init data, that would be passed to SCInitDebugModule()
Definition: util-debug.h:154
SCLogLevel log_level
Definition: util-debug.h:139
SCLogOPType
Definition: util-debug.h:77
void SCLogRegisterTests(void)
Definition: util-debug.c:1671
SCLogLevel sc_log_global_log_level
Holds the global log level. Is the same as sc_log_config->log_level.
Definition: util-debug.c:95
SCError
Definition: util-error.h:29
pcre_extra * op_filter_regex_study
Definition: util-debug.h:184
char msg[SC_LOG_MAX_LOG_MSG_LEN]
Definition: util-debug.h:113
struct SCLogInitData_ SCLogInitData
Structure containing init data, that would be passed to SCInitDebugModule()
SCLogOPIfaceCtx * op_ifaces
Definition: util-debug.h:187
int SCLogDebugEnabled(void)
Returns whether debug messages are enabled to be logged or not.
Definition: util-debug.c:624
The output interface context for the logging module.
Definition: util-debug.h:121
pcre * op_filter_regex
Definition: util-debug.h:183
struct SCLogOPIfaceCtx_ SCLogOPIfaceCtx
The output interface context for the logging module.
SCLogOPBuffer * SCLogAllocLogOPBuffer(void)
Allocates an output buffer for an output interface. Used when we want the op_interface log_format to ...
Definition: util-debug.c:643
#define SCLogConfig(...)
Definition: util-debug.h:259
const char * log_format
Definition: util-debug.h:115
void SCLogDeInitLogModule(void)
De-Initializes the logging module.
Definition: util-debug.c:1468
SCError SCLogMessage(const SCLogLevel, const char *, const unsigned int, const char *, const SCError, const char *message)
Adds the global log_format to the outgoing buffer.
Definition: util-debug.c:541
const char * global_log_format
Definition: util-debug.h:162
struct SCLogOPIfaceCtx_ * next
Definition: util-debug.h:147
int sc_log_module_cleaned
Used to indicate whether the logging module has been cleaned or not.
Definition: util-debug.c:105
void SCLogInitLogModule(SCLogInitData *)
Initializes the logging module.
Definition: util-debug.c:1252
SCMutex fp_mutex
Definition: util-debug.h:145
void SCLogAppendOPIfaceCtx(SCLogOPIfaceCtx *, SCLogInitData *)
Appends an output_interface to the output_interface list sent in head.
Definition: util-debug.c:1167
char * op_filter
Definition: util-debug.h:181