Skip to content

Arduino logger with support for preprocessor directives

License

Notifications You must be signed in to change notification settings

Incuvers/macro-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Macro Logger

ci

Modified: 2021-06

img

Navigation

  1. About
  2. Quickstart
  3. License

About

Macro Logger is an arduino logging library with support for precompilation directives and printf formatting. This library is adapted from Christopher Baker's Logger library.

Quickstart

Install the library from the arduino-cli package manager:

arduino-cli lib install MacroLogger

Below is a snippet of the basic usage:

#include <Logger.h>

void setup() {
  Serial.begin(9600);
  Logger::set_level(Logger::Level::WARNING);
}

void loop() {
  Logger::critical("This is a critical logging message");
  Logger::error("This is a error logging message");
  Logger::warning("This is a warning logging message");
  Logger::info("This is an info logging message: %d", 5);
  Logger::trace("This is a trace logging message: %s", "");
  delay(500);
}

Serial monitor output:

[CRITICAL] loop:25 This is a critical logging message
[ERROR] loop:25 This is a error logging message
[WARNING] loop:25 This is a warning logging message
[INFO] loop:25 This is an info logging message: 5
[TRACE] loop:25 This is a trace logging message:  

Licence

MIT License