Marat Dukhan | 547fa36 | 2017-03-03 02:47:26 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <inttypes.h> |
| 4 | |
| 5 | #define CPUINFO_LOG_ERROR 1 |
| 6 | #define CPUINFO_LOG_WARNING 2 |
| 7 | #define CPUINFO_LOG_INFO 3 |
| 8 | #define CPUINFO_LOG_DEBUG 4 |
| 9 | |
Marat Dukhan | a8fb3dd | 2017-08-09 13:49:39 -0700 | [diff] [blame] | 10 | #define CPUINFO_LOG_DEBUG_PARSERS 0 |
| 11 | |
Marat Dukhan | 547fa36 | 2017-03-03 02:47:26 -0500 | [diff] [blame] | 12 | #ifndef CPUINFO_LOG_LEVEL |
| 13 | #define CPUINFO_LOG_LEVEL CPUINFO_LOG_ERROR |
| 14 | #endif |
| 15 | |
| 16 | #ifdef __GNUC__ |
| 17 | __attribute__((__format__(__printf__, 1, 2))) |
| 18 | #endif |
| 19 | #if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_DEBUG |
| 20 | void cpuinfo_log_debug(const char* format, ...); |
| 21 | #else |
| 22 | static inline void cpuinfo_log_debug(const char* format, ...) { } |
| 23 | #endif |
| 24 | |
| 25 | #ifdef __GNUC__ |
| 26 | __attribute__((__format__(__printf__, 1, 2))) |
| 27 | #endif |
| 28 | #if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_INFO |
| 29 | void cpuinfo_log_info(const char* format, ...); |
| 30 | #else |
| 31 | static inline void cpuinfo_log_info(const char* format, ...) { } |
| 32 | #endif |
| 33 | |
| 34 | #ifdef __GNUC__ |
| 35 | __attribute__((__format__(__printf__, 1, 2))) |
| 36 | #endif |
| 37 | #if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_WARNING |
| 38 | void cpuinfo_log_warning(const char* format, ...); |
| 39 | #else |
| 40 | static inline void cpuinfo_log_warning(const char* format, ...) { } |
| 41 | #endif |
| 42 | |
| 43 | #ifdef __GNUC__ |
| 44 | __attribute__((__format__(__printf__, 1, 2))) |
| 45 | #endif |
| 46 | #if CPUINFO_LOG_LEVEL >= CPUINFO_LOG_ERROR |
| 47 | void cpuinfo_log_error(const char* format, ...); |
| 48 | #else |
| 49 | static inline void cpuinfo_log_error(const char* format, ...) { } |
| 50 | #endif |