-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlog.h
53 lines (41 loc) · 833 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
47
48
49
50
51
52
53
/* log.h */
/* Part of hhttppss, a simple HTTP server skeleton
* Author: Berke Durak
* Released in the public domain
*/
#ifndef LOG_H
#define LOG_H
typedef enum
{
LOG_DEBUG, /* 0 */
LOG_INFO, /* 1 */
LOG_DATA, /* 2 */
LOG_WARN, /* 3 */
LOG_ERROR, /* 4 */
LOG_COUNT
} log_priority;
#ifdef DEBUG
#define DEBUG_TEST 1
#else
#define DEBUG_TEST 0
#endif
/* needs c99. */
/* """""""""" */
#define debug(fmt, ...) \
do \
{ \
if (DEBUG_TEST) \
fprintf(stderr, fmt, __VA_ARGS__); \
} while (0)
FILE *
log_init(char *log_file);
void
log_shutdown();
void
fatal(const char *format, ...);
void
error(char *msg, ...);
void
trace(log_priority p, char *msg, ...);
extern FILE *log_fh;
#endif