8000 GitHub - MarcosHelbert/Logger: A lightweight logging library for microcontrollers (Arduino, ESP32) with five log levels, perfect for debugging via PlatformIO.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A lightweight logging library for microcontrollers (Arduino, ESP32) with five log levels, perfect for debugging via PlatformIO.

License

Notifications You must be signed in to change notification settings

MarcosHelbert/Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LOGGER

A lightweight and efficient logging library designed for microcontrollers such as Arduino, ESP32, and similar devices. Logger simplifies debugging and monitoring by providing structured log output, tailored specifically for embedded systems.

Compatible with PlatformIO, this library is easy to integrate and optimized for resource-constrained devices.

Table of Contents

Features

  • Log Levels: Supports five essential levels: Debug, Info, Warn, Error, and Critical.
  • PlatformIO Compatible: Seamlessly integrates into PlatformIO-based projects.
  • Low Resource Usage: Designed for minimal memory and CPU overhead.

Limitations

  • No Custom Log Levels: Only supports pre-defined levels (Debug, Info, Warn, Error, Critical).
  • No Persistent Storage: Logs are currently not saved to non-volatile memory or external storage.
  • Not Extensible: The library does not support plugins or additional features at this time.

Installation

Clone or download the repository and integrate it with your PlatformIO project:

  1. Copy the Logger library folder into your project's lib directory.
  2. Include the library in your code.

Usage

Basic Example

#include <Arduino.h>
#include <Logger.h>

Logger logger(Debug, "[{time}] {level} [{file}.{function}.{lineno}] {message}"); // Create a logger instance with log level Info

void setup()
{
    Serial.begin(115200);

    Serial.println("\n");
    LOG(Debug, "This is a debug message");
    LOG(Info, "This is the number %d: %d", 3, 3);
    LOG(Warning, "Countdown: %d, %d, %d", 3, 2, 1);
    LOG(Error, "Error encountered: %s", "Value invalid");
    LOG(Critical, "This is a critical message");
}

Supported Log Levels

The library supports the following log levels:

  1. Debug: Detailed information for debugging.
  2. Info: General system information.
  3. Warn: Warnings for potential issues.
  4. Error: Errors requiring immediate attention.
  5. Critical: Severe issues affecting system stability.

Logger Configuration

Customize the logger when initializing:

Logger logger({Log Level}, {Log Format}); // Enable timestamps in the Serial output

Configuration Options:

  • Log Level: Set the minimum log level to display (e.g., Debug, Info, Warn, Error, Critical).
  • Log Format: Define the format for log messages, including placeholders for timestamp, log level, file, function, line number, and message.

Project Roadmap

  • Persistent Logs: Add support for saving logs to SD cards or EEPROM.
  • Multi-Interface Support: Enable logging over UART, I2C, or SPI.

Contributing

Contributions are welcome! Here's how you can help:

Contributor Graph

License

This project is protected under the MIT License. For more details, refer to the LICENSE file.

Author

Developed by Marcos Helbert.

Feel free to open issues or share suggestions for improving the library!

About

A lightweight logging library for microcontrollers (Arduino, ESP32) with five log levels, perfect for debugging via PlatformIO.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0