I've created a little logging tool, somewhat similar to the one ESP32 has. I wrote it for myself, but I think it can be userful for others, too - so here it is:
https://github.com/FrankBoesing/Teensy_Logger
After installation, you can set the log level via the Arduino-Menu:
Here is a short example:
So, for development, you can insert a lot of debug information to your program, and just switch it on and off via the menu.
The syntax is similar to printf, (it uses printf) so you can use all printf format-strings.
There are a few additional, optional macros (set before the #include):
#define LOGDEVICE Serial // <- device to log to
#define LOGTIMESTAMP // print a Timestamp?
#define LOGPRINTLEVEL // add inofrmation about loglevel of LOGx Macro
Output with timestamp and loglevel:
https://github.com/FrankBoesing/Teensy_Logger
After installation, you can set the log level via the Arduino-Menu:
Here is a short example:
Code:
#include <teensy_logger.h>
void setup() {
Serial.printf("Log Level: %d\n", LOG_LEVEL);
}
void loop() {
delay(1002);
Serial.println("===");
LOGE("%s", "Error");
LOGW("%s", "This is a warning :)");
LOGI("%s", "Information!");
LOGD("%s %d %s", "Debug", __LINE__, __FILE__);
LOGV("%s", "Verbose");
}
So, for development, you can insert a lot of debug information to your program, and just switch it on and off via the menu.
The syntax is similar to printf, (it uses printf) so you can use all printf format-strings.
There are a few additional, optional macros (set before the #include):
#define LOGDEVICE Serial // <- device to log to
#define LOGTIMESTAMP // print a Timestamp?
#define LOGPRINTLEVEL // add inofrmation about loglevel of LOGx Macro
Output with timestamp and loglevel:
Code:
00:00:40.201 [WARNING] This is a warning :)
Last edited: