Skip to content

An Arduino library for simple and clean-looking logging

License

Notifications You must be signed in to change notification settings

Farossco/ArduinoLogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArduinoLogger

An Arduino library for simple and clean-looking logging

This library allows you to easily add logging to your program. It is mainly made for long-term projects or projects that need constant logging (into an SD card for example) as it does not provide a way to easily compile out all the logging codes.

Features

  • Intuitive usage
  • Several log levels (Error, Warning, Info, Trace, Verbose)
  • Multi-output: Logs the message on several outputs at once
  • Logging using the iostream style (<<)
  • Supports all kind of Print output
  • Displays a prefix with a clock and the logging level (Configurable)

Tested for

  • Arduino Mega
  • ESP8266
  • ESP32

Available platforms

  • Atmel AVR
  • ESP32
  • ESP8266

Installation

PlatformIO

This library is available on the PlatformIO package manager.

To install it, simply add it to your platformio.ini file under lib_deps

Example :

[env:Arduino]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps = ArduinoLogger

Arduino IDE

If you're using the Arduino IDE, you need to manually install this library

The library folder is usually under :

  • C:\users\[you]\documents\Arduino on Windows
  • /home/[you]/Arduino on Linux

Usage

This library is made to be very simple to use. To initialize the logger for an output, you need to provide the output and the log level.

If you're using a Serial as your output, you still need to call Serial.begin()

logger.add (Serial, LOG_LEVEL_VERBOSE); 

err << "This is an error message" << endl;
warn << "This is a warning message" << endl;
inf << "This is an info message" << endl;
trace << "This is a trace message" << endl;
verb << "This is a verbose message" << endl;

Dependencies

  • Time library for clock prefix display

About

An Arduino library for simple and clean-looking logging

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages