This repository was archived by the owner on Oct 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.h
More file actions
123 lines (87 loc) · 2.49 KB
/
debug.h
File metadata and controls
123 lines (87 loc) · 2.49 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* File: debug.h
* Author: hanky
*
* Created on February 23, 2014, 4:18 PM
*/
#ifndef DEBUG_H
#define DEBUG_H
#include "fnasso.h"
#ifdef __cplusplus
extern "C" {
#endif
#define FNASSO_FUNC_TRACE_DEBUG 0
#define FNASSO_DEBUG 1
#define FNASSO_EVENT 2
#define FNASSO_WARN 3
#define FNASSO_ERROR 4
#ifdef FTRACE_DEBUG_VERSION
#ifndef DEBUG_VERSION
#define DEBUG_VERSION
#endif
#endif
#ifdef DEBUG_MODE
#define F_BEGIN() {\
fnasso_func_start(__FUNCTION__);\
}
#define RETURN(status) {\
fnasso_func_end(FNASSO_FUNC_TRACE_DEBUG, __FUNCTION__, status);\
return status;\
}
#define E_RETURN(status, args...) {\
fnasso_printf(FNASSO_ERROR, __FUNCTION__, fnasso_strerror(status), ##args);\
fnasso_func_end(FNASSO_FUNC_TRACE_DEBUG, __FUNCTION__, status);\
return status;\
}
#define E_THROW(status) {\
fnasso_func_end(FNASSO_FUNC_TRACE_DEBUG, __FUNCTION__, status);\
return status;\
}
#define F_EXIT(status) {\
fnasso_func_end(FNASSO_ERROR, __FUNCTION__, status);\
exit(status);\
}
#define DEBUG(fmt, args...) {\
fnasso_printf(FNASSO_DEBUG, __FUNCTION__, fmt, ##args);\
}
#define EVENT(fmt, args...) {\
fnasso_printf(FNASSO_EVENT, __FUNCTION__, fmt, ##args);\
}
#define WARN(fmt, args...) {\
fnasso_printf(FNASSO_WARN, __FUNCTION__,fmt, ##args);\
}
#define ERROR(fmt, args...) {\
fnasso_printf(FNASSO_ERROR, __FUNCTION__,fmt, ##args);\
}
#else /* DEBUG_VERSION */
#define F_BEGIN() {\
}
#define RETURN(status) {\
return status;\
}
#define E_RETURN(status, args...) {\
fnasso_printf(FNASSO_ERROR, __FUNCTION__, fnasso_strerror(status), ##args);\
return status;\
}
#define E_THROW(status) {\
return status;\
}
#define F_EXIT(status, args...) {\
exit(status);\
}
#define DEBUG(fmt, args...) {\
}
#define EVENT(fmt, args...) {\
fnasso_printf(FNASSO_EVENT, __FUNCTION__, fmt, ##args);\
}
#define WARN(fmt, args...) {\
fnasso_printf(FNASSO_WARN, __FUNCTION__,fmt, ##args);\
}
#define ERROR(fmt, args...) {\
fnasso_printf(FNASSO_ERROR, __FUNCTION__,fmt, ##args);\
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* DEBUG_H */