Flash Translation Layer
1.0
include
log.h
Go to the documentation of this file.
1
#ifndef LOG_H
2
#define LOG_H
3
4
#ifdef __cplusplus
5
extern
"C"
{
6
#endif
7
8
#include <stdio.h>
9
10
#define STRINGIFY(x) #x
11
#define TOSTRING(x) STRINGIFY(x)
12
13
#ifdef DEBUG
14
#define pr_debug(fmt, ...) \
15
fprintf(stdout, \
16
"DEBUG:[" __FILE__ ":%s(" TOSTRING(__LINE__) ")] " fmt, \
17
__func__, ##__VA_ARGS__)
18
#else
19
#define pr_debug(...) (void)0
20
#endif
21
22
#define pr_info(fmt, ...) \
23
fprintf(stdout, "INFO:[" __FILE__ ":%s(" TOSTRING(__LINE__) ")] " fmt, \
24
__func__, ##__VA_ARGS__)
25
26
#define pr_warn(fmt, ...) \
27
fprintf(stderr, \
28
"WARNING:[" __FILE__ ":%s(" TOSTRING(__LINE__) ")] " fmt, \
29
__func__, ##__VA_ARGS__)
30
31
#define pr_err(fmt, ...) \
32
fprintf(stderr, \
33
"ERROR:[" __FILE__ ":%s(" TOSTRING(__LINE__) ")] " fmt, \
34
__func__, ##__VA_ARGS__)
35
36
#ifdef __cplusplus
37
}
38
#endif
39
40
#endif
Generated by
1.8.13