Page 1 of 1

Lua script: is it possible to print text to log with Error level?

Posted: Sunday 16 February 2020 17:16
by psubiaco
Hi.
In lua script, everything I print (using the lua print() function) is put in Domoticz Log file (or syslog) with loglevel=status: for example, the
script_device_power.lua is printing the current consumed power every 2 seconds.
2020-02-16 17:00:42.494 Status: LUA: Power: currentPower=216
2020-02-16 17:00:42.526 Status: EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_power.lua
2020-02-16 17:00:44.434 Status: LUA: Power: currentPower=211
2020-02-16 17:00:44.465 Status: EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_power.lua
2020-02-16 17:00:46.407 Status: LUA: Power: currentPower=211
2020-02-16 17:00:46.424 Status: EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_power.lua

Actually, Domoticz log file is placed on ramdisk, to save SD flash; to reduce the log size I would like to disable loglevel=status !
Is there a way for a lua script to print something using the log level error, so I can get only the needed information?
2020-02-16 17:00:42.494 Error: LUA: Power: currentPower=216
2020-02-16 17:00:44.434 Error: LUA: Power: currentPower=211
2020-02-16 17:00:46.407 Error: LUA: Power: currentPower=211

Thanks a log.
Paolo