diff --git a/examples/CC3200/ccs/MG_hello/main.c b/examples/CC3200/ccs/MG_hello/main.c index 2778979b..999cbd0e 100644 --- a/examples/CC3200/ccs/MG_hello/main.c +++ b/examples/CC3200/ccs/MG_hello/main.c @@ -40,6 +40,7 @@ #include +#include "cs_dbg.h" #include "wifi.h" void fs_slfs_set_new_file_size(const char *name, size_t size); diff --git a/examples/CC3200/cs_dbg.h b/examples/CC3200/cs_dbg.h deleted file mode 120000 index 4c6bc66b..00000000 --- a/examples/CC3200/cs_dbg.h +++ /dev/null @@ -1 +0,0 @@ -./../../../common/cs_dbg.h \ No newline at end of file diff --git a/examples/CC3200/cs_dbg.h b/examples/CC3200/cs_dbg.h new file mode 100644 index 00000000..219ef4d4 --- /dev/null +++ b/examples/CC3200/cs_dbg.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014-2016 Cesanta Software Limited + * All rights reserved + */ + +#ifndef CS_COMMON_CS_DBG_H_ +#define CS_COMMON_CS_DBG_H_ + +#ifndef CS_DISABLE_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +enum cs_log_level { + LL_NONE = -1, + LL_ERROR = 0, + LL_WARN = 1, + LL_INFO = 2, + LL_DEBUG = 3, + LL_VERBOSE_DEBUG = 4, + + _LL_MIN = -2, + _LL_MAX = 5, +}; + +void cs_log_set_level(enum cs_log_level level); + +#ifndef CS_DISABLE_STDIO + +void cs_log_set_file(FILE *file); + +extern enum cs_log_level cs_log_level; +void cs_log_print_prefix(const char *func); +void cs_log_printf(const char *fmt, ...); + +#define LOG(l, x) \ + if (cs_log_level >= l) { \ + cs_log_print_prefix(__func__); \ + cs_log_printf x; \ + } + +#ifndef CS_NDEBUG + +#define DBG(x) \ + if (cs_log_level >= LL_VERBOSE_DEBUG) { \ + cs_log_print_prefix(__func__); \ + cs_log_printf x; \ + } + +#else /* NDEBUG */ + +#define DBG(x) + +#endif + +#else /* CS_DISABLE_STDIO */ + +#define LOG(l, x) +#define DBG(x) + +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CS_COMMON_CS_DBG_H_ */ diff --git a/examples/MSP432/ccs/MG_hello/cs_dbg.h b/examples/MSP432/ccs/MG_hello/cs_dbg.h new file mode 100644 index 00000000..219ef4d4 --- /dev/null +++ b/examples/MSP432/ccs/MG_hello/cs_dbg.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014-2016 Cesanta Software Limited + * All rights reserved + */ + +#ifndef CS_COMMON_CS_DBG_H_ +#define CS_COMMON_CS_DBG_H_ + +#ifndef CS_DISABLE_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +enum cs_log_level { + LL_NONE = -1, + LL_ERROR = 0, + LL_WARN = 1, + LL_INFO = 2, + LL_DEBUG = 3, + LL_VERBOSE_DEBUG = 4, + + _LL_MIN = -2, + _LL_MAX = 5, +}; + +void cs_log_set_level(enum cs_log_level level); + +#ifndef CS_DISABLE_STDIO + +void cs_log_set_file(FILE *file); + +extern enum cs_log_level cs_log_level; +void cs_log_print_prefix(const char *func); +void cs_log_printf(const char *fmt, ...); + +#define LOG(l, x) \ + if (cs_log_level >= l) { \ + cs_log_print_prefix(__func__); \ + cs_log_printf x; \ + } + +#ifndef CS_NDEBUG + +#define DBG(x) \ + if (cs_log_level >= LL_VERBOSE_DEBUG) { \ + cs_log_print_prefix(__func__); \ + cs_log_printf x; \ + } + +#else /* NDEBUG */ + +#define DBG(x) + +#endif + +#else /* CS_DISABLE_STDIO */ + +#define LOG(l, x) +#define DBG(x) + +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CS_COMMON_CS_DBG_H_ */ diff --git a/examples/MSP432/ccs/MG_hello/main.c b/examples/MSP432/ccs/MG_hello/main.c index 7ab423d0..01359a62 100644 --- a/examples/MSP432/ccs/MG_hello/main.c +++ b/examples/MSP432/ccs/MG_hello/main.c @@ -35,6 +35,7 @@ /* Mongoose.h brings in SimpleLink support. Do not include simplelink.h. */ #include +#include "cs_dbg.h" #include "wifi.h" static const char *upload_form = diff --git a/examples/MSP432/ccs/MG_hello/wifi.c b/examples/MSP432/ccs/MG_hello/wifi.c index d55b9c42..467f41b4 100644 --- a/examples/MSP432/ccs/MG_hello/wifi.c +++ b/examples/MSP432/ccs/MG_hello/wifi.c @@ -1,3 +1,4 @@ +#include "cs_dbg.h" #include "wifi.h" #include "mongoose.h"