diff --git a/examples/19-WebLog/19-WebLog.ino b/examples/19-WebLog/19-WebLog.ino index 32a4905..6278ff8 100644 --- a/examples/19-WebLog/19-WebLog.ino +++ b/examples/19-WebLog/19-WebLog.ino @@ -1,7 +1,7 @@ /********************************************************************************* * MIT License * - * Copyright (c) 2020 Gregg E. Berman + * Copyright (c) 2022 Gregg E. Berman * * https://github.com/HomeSpan/HomeSpan * diff --git a/examples/19-WebLog/DEV_LED.h b/examples/19-WebLog/DEV_LED.h index 07c7552..23f555c 100644 --- a/examples/19-WebLog/DEV_LED.h +++ b/examples/19-WebLog/DEV_LED.h @@ -28,6 +28,8 @@ struct DEV_LED : Service::LightBulb { // First we create a derived digitalWrite(ledPin,power->getNewVal()); // use a standard Arduino function to turn on/off ledPin based on the return of a call to power->getNewVal() (see below for more info) WEBLOG("LED on Pin %d: %s",ledPin,power->getNewVal()?"ON":"OFF"); + LOG1("LOG1: LED on Pin %d: %s",ledPin,power->getNewVal()?"ON":"OFF"); + LOG2("LOG2: LED on Pin %d: %s",ledPin,power->getNewVal()?"ON":"OFF"); return(true); // return true to indicate the update was successful (otherwise create code to return false if some reason you could not turn on the LED) diff --git a/src/Settings.h b/src/Settings.h index 9c1f345..ec43965 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -98,8 +98,8 @@ // Message Log Level Control Macros // // 0=Minimal, 1=Informative, 2=All // -#define LOG1(x) if(homeSpan.logLevel>0)Serial.print(x) -#define LOG2(x) if(homeSpan.logLevel>1)Serial.print(x) +#define LOG1(format,...) if(homeSpan.logLevel>0)Serial.print ##__VA_OPT__(f)(format __VA_OPT__(,) __VA_ARGS__) +#define LOG2(format,...) if(homeSpan.logLevel>1)Serial.print ##__VA_OPT__(f)(format __VA_OPT__(,) __VA_ARGS__) #define WEBLOG(format,...) homeSpan.webLog.addLog(format __VA_OPT__(,) __VA_ARGS__)