-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.h
37 lines (29 loc) · 772 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
#ifndef LOG_H
#define LOG_H
#include <err.h>
#include <stdio.h>
#ifndef NOLOG
#define LOG(...) \
fprintf(stderr, "[LOG] "); \
warn(__VA_ARGS__);
#define LOGX(...) \
fprintf(stderr, "[LOG] "); \
warnx(__VA_ARGS__);
#endif
#ifndef NOWARN
#define WARN(...) \
fprintf(stderr, "[WARNING] at '%s', '%s'\n-> ", __FILE__, __func__); \
warn(__VA_ARGS__);
#define WARNX(...) \
fprintf(stderr, "[WARNING] at '%s', '%s'\n-> ", __FILE__, __func__); \
warnx(__VA_ARGS__);
#endif
#ifndef NOERR
#define ERR(...) \
fprintf(stderr, "[ERROR] at '%s', '%s'\n-> ", __FILE__, __func__); \
err(__VA_ARGS__);
#define ERRX(...) \
fprintf(stderr, "[ERROR] at '%s', '%s'\n-> ", __FILE__, __func__); \
errx(__VA_ARGS__);
#endif
#endif /* ! */