-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.h
31 lines (21 loc) · 863 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
#ifndef __LOG_H__
#define __LOG_H__
#include <stdio.h>
#include <string.h>
#include <errno.h>
#define LOG_PERROR(m) \
fprintf(stderr, "!! [%s] error: "m": %s\n", get_time(), strerror(errno));
#define LOG_PERROR_VA(m, ...) \
fprintf(stderr, "!! [%s] error: "m": %s\n", get_time(), __VA_ARGS__, strerror(errno));
#define LOG_ERROR(m) \
fprintf(stderr, "!! [%s] error: "m"\n", get_time());
#define LOG_ERROR_VA(m, ...) \
fprintf(stderr, "!! [%s] error: "m"\n", get_time(), __VA_ARGS__);
#define LOG_INFO(m) \
fprintf(stdout, ":: [%s] "m"\n", get_time());
#define LOG_INFO_VA(m, ...) \
fprintf(stdout, ":: [%s] "m"\n", get_time(), __VA_ARGS__);
#define LOG_DEBUG(fmt, ...) \
fprintf(stderr, ":: [%s] "fmt, get_time(), __VA_ARGS__);
const char *get_time(void);
#endif /* __LOG_H__ */