Logger Implementation Slf4j with varargs

You can use the logInfo openHAB Actions directly.

var Log = Java.type("org.openhab.core.model.script.actions.Log");
Log.logError("Experiments", "This is an OH error log");
Log.logWarn("Experiments", "This is an OH warn log");
Log.logInfo("Experiments", "This is an OH info log");
Log.logDebug("Experiments", "This is an OH debug log");

I can’t suggest anything concerning the multiple arguments. I’d definitely trust jpg0 on that part.

And if you wanted to, you could save the methods to local variables…

var logInfo = Log.logInfo

You could put that into a library that you import and use in all of your rules.

1 Like