-
Notifications
You must be signed in to change notification settings - Fork 3
/
log.h
39 lines (33 loc) · 927 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
/**
*
* portmap log part
*
* author: liyangguang (liyangguang@software.ict.ac.cn)
*
* date: 2011-01-14 15:27:01
*
* changes
*/
#ifndef _PORTMAP_LOG_H
#define _PORTMAP_LOG_H
void log_write(const char *level, const char *func, const char *file, int line, const char *fmt,
...);
int log_init(const char *log_file);
int log_close();
#define LOG_INFO(fmt, args...) \
do { \
log_write("LOG_INFO", __func__, __FILE__, __LINE__, fmt, ##args); \
}while(0)
#ifdef DEBUG
#define LOG_DEBUG(fmt, args...) \
do { \
log_write("LOG_DEBUG", __func__, __FILE__, __LINE__, fmt, ##args); \
}while(0)
#else
#define LOG_DEBUG(fmt, args...) do{}while(0)
#endif /* ifdef DEBUG */
#define LOG_ERR(fmt, args...) \
do{ \
log_write("LOG_ERR", __func__, __FILE__, __LINE__, fmt, ##args); \
}while(0)
#endif /* _PORTMAP_LOG_H */