Debug/Log library v0.1 released

Hi list, I created a library for debugging/logging. I released the code under GPL license at my site: Please fill free to use it and give feedback.

Sincerely, Meir (falafel)

A few suggestions:

  • Make #define macros for triggering the logging, because then you won't get an overhead when the logging is off
  • Require a Print object in the constructor, so the user can choose which Printer he wants to dedicate to logging.
  • Add constants for 'verbosity level' so users won't have to remember the integer values

I threw some code together:

#define LOG(logsetup,level,text) if (logsetup.logLevel>=level){logsetup.printer->println(text);}

enum LogLevel {

struct LogSetup {
      LogSetup(Print &print, LogLevel level) {
            printer = &print;
            logLevel = level;
      Print* printer;
      LogLevel logLevel;

void setup() {
      LogSetup logSetup(Serial,LOG_ERROR);


void loop() { /*no loop*/ }

This will add an if check, so a bit overhead is introduced.

Thanks, I will see how to implement the things you pointed out.

I would like to avoid the overhead on the users .pde file an I also prefer short commands with minimum arguments.
I see the need for both approaches.
I would try to use conditional loading in order to reduce the footprint of the code.


Good luck, and report back when you want some more feedback?

BTW: Sorry for highjacking your thread with that Logthingy :)