Press buttons to activate the LED.
Dependencies: BLE_API nRF51822
Fork of Puck by
Diff: Log.h
- Revision:
- 7:c07c01c2a741
- Child:
- 12:8a8cc109f048
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Log.h Thu Jul 24 09:25:42 2014 +0000 @@ -0,0 +1,60 @@ +#ifndef __LOG__H__ +#define __LOG__H__ + + +#ifdef LOG_LEVEL_VERBOSE + #define __PUCK_LOG_LEVEL_VERBOSE__ +#endif +#ifdef LOG_LEVEL_DEBUG + #define __PUCK_LOG_LEVEL_DEBUG__ +#endif +#ifdef LOG_LEVEL_INFO + #define __PUCK_LOG_LEVEL_INFO__ +#endif +#ifdef LOG_LEVEL_WARN + #define __PUCK_LOG_LEVEL_WARN__ +#endif +#ifdef LOG_LEVEL_ERROR + #define __PUCK_LOG_LEVEL_ERROR__ +#endif + +#ifdef __PUCK_LOG_LEVEL_VERBOSE__ + #define LOG_VERBOSE(fmt, ...) do { logger.printf("[V] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) + #define __PUCK_LOG_LEVEL_DEBUG__ +#else + #define LOG_VERBOSE(fmt, ...) +#endif + +#ifdef __PUCK_LOG_LEVEL_DEBUG__ + #define LOG_DEBUG(fmt, ...) do { logger.printf("[D] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) + #define __PUCK_LOG_LEVEL_INFO__ +#else + #define LOG_DEBUG(fmt, ...) +#endif + +#ifdef __PUCK_LOG_LEVEL_INFO__ + #define LOG_INFO(fmt, ...) do { logger.printf("[I] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) + #define __PUCK_LOG_LEVEL_WARN__ +#else + #define LOG_INFO(fmt, ...) +#endif + +#ifdef __PUCK_LOG_LEVEL_WARN__ + #define LOG_WARN(fmt, ...) do { logger.printf("![W] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) + #define __PUCK_LOG_LEVEL_ERROR__ +#else + #define LOG_WARN(fmt, ...) +#endif + +#ifdef __PUCK_LOG_LEVEL_ERROR__ + #define LOG_ERROR(fmt, ...) do { logger.printf("!![E] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) +#else + #define LOG_ERROR(fmt, ...) +#endif + +#ifdef __PUCK_LOG_LEVEL_ERROR__ + static Serial logger(USBTX, USBRX); +#endif + + +#endif //__LOG__H__ \ No newline at end of file