TinyRobotics
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LoggerClass Class Reference

Simple, cross-platform logger for Arduino and C++ environments. More...

#include <LoggerClass.h>

Public Types

enum  Level { ERROR = 0 , WARN = 1 , INFO = 2 , DEBUG = 3 }
 

Public Member Functions

 LoggerClass (Level level=INFO)
 
bool begin (Level level)
 
void setLevel (Level level)
 
void error (const char *fmt,...)
 
void warn (const char *fmt,...)
 
void info (const char *fmt,...)
 
void debug (const char *fmt,...)
 

Protected Member Functions

void vlog (Level level, const char *fmt, va_list args)
 
const char * levelToString (Level level) const
 

Protected Attributes

Level minLevel
 

Detailed Description

Simple, cross-platform logger for Arduino and C++ environments.

This class provides a lightweight logging facility with support for log levels (ERROR, WARN, INFO, DEBUG), printf-style formatting, and platform-adaptive output (Serial for Arduino, printf for standard C++). It is designed for embedded and robotics applications where monitoring, debugging, and event tracking are essential.

Features

Usage Example

TRLogger.setLevel(LoggerClass::DEBUG);
TRLogger.info("System started, version: %d", version);
TRLogger.error("Failed to open file: %s", filename);
TRLogger.debug("x=%.2f, y=%.2f", x, y);

Methods

Log Levels

Platform Support

Author
Phil Schatzmann

The documentation for this class was generated from the following file: