-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.h
31 lines (25 loc) · 1013 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
/*
* moto-design SGV utils.
*/
#if ! defined(_MD_GENERATOR_LOG_H)
#define _MD_GENERATOR_LOG_H
#include <math.h>
#include <stdbool.h>
void __attribute__((unused)) __attribute__ ((format (printf, 3, 4)))
_error(const char *func, int line, const char *fmt, ...);
void __attribute__((unused)) __attribute__ ((format (printf, 3, 4)))
_log(const char *func, int line, const char *fmt, ...);
void __attribute__((unused)) __attribute__ ((format (printf, 3, 4)))
_warn(const char *func, int line, const char *fmt, ...);
void log_set_exit_on_error(bool state);
void log_set_verbose(bool state);
bool log_get_verbose(void);
#if defined(DEBUG)
# define debug(_args...) do {_log(__func__, __LINE__, _args);} while(0)
#else
# define debug(...) do {} while(0)
#endif
# define error(_args...) do {_error(__func__, __LINE__, _args);} while(0)
# define log(_args...) do {_log(__func__, __LINE__, _args);} while(0)
# define warn(_args...) do {_warn(__func__, __LINE__, _args);} while(0)
#endif /* _MD_GENERATOR_LOG_H */