Helpful logging and error format
Inspired by this blog post.
Work in Progress
Diff: LogUtil.h
- Revision:
- 8:509ffcfb849f
- Parent:
- 7:ef45bd2cd9bb
diff -r ef45bd2cd9bb -r 509ffcfb849f LogUtil.h --- a/LogUtil.h Fri May 10 18:36:27 2013 +0000 +++ b/LogUtil.h Sun Dec 18 01:30:53 2022 +0000 @@ -25,18 +25,18 @@ #include <stdio.h> #include <stdlib.h> -#include "mbed.h" +#include "BufferedSerial.h" #define STREAM stdout -#define LOG(...) \ +#define LLOG(...) \ fprintf(STREAM, "LOG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ fprintf(STREAM, ##__VA_ARGS__); \ fflush(STREAM) -#define WARN(...) \ +#define WWARN(...) \ fprintf(STREAM, "WARN: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ fprintf(STREAM, ##__VA_ARGS__); \ fflush(STREAM) -#define ERROR(...) \ +#define EERROR(...) \ fprintf(STREAM, "ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ fprintf(STREAM, ##__VA_ARGS__); \ fflush(STREAM); \ @@ -76,12 +76,12 @@ class LogUtil { private: - Serial *_serial; + BufferedSerial *_serial; public: /** Construct the LogUtil class and configure */ - LogUtil(Serial &serial, uint32_t baudrate = 0); + LogUtil(BufferedSerial &serial, uint32_t baudrate = 0); };