-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlog.h
More file actions
25 lines (19 loc) · 791 Bytes
/
log.h
File metadata and controls
25 lines (19 loc) · 791 Bytes
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
#ifndef __LOG_H
#define __LOG_H
#define FATAL 4
#define ERROR 3
#define WARN 2
#define INFO 1
#define DEBUG 0
void log_print(int level, char *file, int line, char *fmt, ...);
#define LOG(level, fmt, args...) log_print(level, __FILE__,__LINE__, fmt, ##args)
#define LOG_DEBUG(fmt, args...) log_print(DEBUG, __FILE__,__LINE__, fmt, ##args)
#define LOG_INFO(fmt, args...) log_print(INFO, __FILE__,__LINE__, fmt, ##args)
#define LOG_WARN(fmt, args...) log_print(WARN, __FILE__,__LINE__, fmt, ##args)
#define LOG_ERROR(fmt, args...) log_print(ERROR, __FILE__,__LINE__, fmt, ##args)
#define LOG_FATAL(fmt, args...) log_print(FATAL, __FILE__,__LINE__, fmt, ##args)
int log_set_file(char *file);
int log_close_file();
int log_set_level(int level);
int log_set_opt(int opt);
#endif