Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 1.42 KB

README.md

File metadata and controls

50 lines (41 loc) · 1.42 KB

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