-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.h
46 lines (37 loc) · 855 Bytes
/
log.h
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
36
37
38
39
40
41
42
43
44
45
46
#ifndef LOG_H
#define LOG_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef DEBUG
# define debug logit
#else
# define debug fake_logit
#endif
/* __FUNCTION__ is a gcc extension */
#ifndef HAVE__FUNCTION__
# define __FUNCTION__ "UNKNOWN_FUNC"
#endif
#ifndef NDEBUG
# define logit(format, ...) \
internal_logit (__FILE__, __LINE__, __FUNCTION__, format, \
## __VA_ARGS__)
#else
# define logit fake_logit
#endif
#ifdef HAVE__ATTRIBUTE__
void internal_logit (const char *file, const int line, const char *function,
const char *format, ...)
__attribute__ ((format (printf, 4, 5)));
#else
void internal_logit (const char *file, const int line, const char *function,
const char *format, ...);
#endif
void fake_logit (const char *format, ...);
void log_init_stream (FILE *f);
void log_close ();
#ifdef __cplusplus
}
#endif
#endif