forked from lichao2014/name_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.h
More file actions
19 lines (15 loc) · 733 Bytes
/
log.h
File metadata and controls
19 lines (15 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef _LOG_H_INCLUDED
#define _LOG_H_INCLUDED
#include <stdio.h>
#include <unistd.h>
#define LOG(level, fmt, ...) \
do { \
printf(#level "|#%d,%s:%d|", getpid(), __FUNCTION__, __LINE__); \
printf(fmt, ##__VA_ARGS__); \
fflush(stdout); \
} while(0)
#define DEBUG_LOG(fmt, ...) LOG(DEBUG, fmt, ##__VA_ARGS__)
#define WARN_LOG(fmt, ...) LOG(WARN, fmt, ##__VA_ARGS__)
#define INFO_LOG(fmt, ...) LOG(INFO, fmt, ##__VA_ARGS__)
#define ERROR_LOG(fmt, ...) LOG(ERROR, fmt, ##__VA_ARGS__)
#endif //!_LOG_H_INCLUDED