Checking the logging level in the dzVents script

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Checking the logging level in the dzVents script

Post by rgroothuis »

How can I check the logging level in the dzVents script. I want to do something like:

if (logging.level == domoticz.LOG_DEBUG) then
-- Print something / send Telegram notification.
end

But logging variable is not known, I get the following error:

Code: Select all

2021-05-17 08:00:00.353 Error: dzVents: Error: (3.0.2) ControlDoorLock: ...cz/scripts/dzVents/generated_scripts/ContolDoorLocks.lua:57: attempt to index a nil value (global 'logging')
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Checking the logging level in the dzVents script

Post by waaren »

rgroothuis wrote: Monday 17 May 2021 10:30 How can I check the logging level in the dzVents script.
Use _G.logLevel to get the current script dzVents loglevel

Code: Select all

        domoticz.log('logLevel is now ' .. _G.logLevel,domoticz.LOG_FORCE)
        domoticz.log('domoticz.LOG_INFO = ' .. domoticz.LOG_INFO)
        domoticz.log('domoticz.LOG_DEBUG = ' .. domoticz.LOG_DEBUG)
        domoticz.log('domoticz.LOG_ERROR = ' .. domoticz.LOG_ERROR)
        domoticz.log('domoticz.LOG_FORCE = ' .. domoticz.LOG_FORCE)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Checking the logging level in the dzVents script

Post by rgroothuis »

THanks, looks like that is indeed the trick, thanks for your always fast response with many solutions. Cheers.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest