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

Moderator: leecollings

Post Reply
User avatar
psubiaco
Posts: 233
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

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

Post 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
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest