File: grok_logging.h

package info (click to toggle)
grok 1.20110708.1-4.3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,460 kB
  • sloc: ansic: 3,469; ruby: 987; makefile: 276; sh: 124; yacc: 106
file content (35 lines) | stat: -rw-r--r-- 883 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef _LOGGING_H_
#define _LOGGING_H_

#include "grok.h"

#define LOG_PREDICATE (1 << 0)
#define LOG_COMPILE (1 << 1)
#define LOG_EXEC (1 << 2)
#define LOG_REGEXPAND (1 << 3)
#define LOG_PATTERNS (1 << 4)
#define LOG_MATCH (1 << 5)
#define LOG_CAPTURE (1 << 6)
#define LOG_PROGRAM (1 << 7)
#define LOG_PROGRAMINPUT (1 << 8)
#define LOG_REACTION (1 << 9)
#define LOG_DISCOVER (1 << 10)

#define LOG_ALL (~0)

#ifdef NOLOGGING
/* this 'args...' requires GNU C */
#  define grok_log(obj, level, format, args...) { }
#else

void _grok_log(int level, int indent, const char *format, ...);

/* let us log anything that has both a 'logmask' and 'logdepth' member */
#  define grok_log(obj, level, format, args...) \
  if ((obj)->logmask & level) \
    _grok_log(level, (obj)->logdepth, "[%s:%d] " format, \
              __FUNCTION__, __LINE__, ## args)

#endif

#endif /* _LOGGING_H_ */