Page 1 of 1

Checking the logging level in the dzVents script

Posted: Monday 17 May 2021 10:30
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')

Re: Checking the logging level in the dzVents script

Posted: Monday 17 May 2021 11:07
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)

Re: Checking the logging level in the dzVents script

Posted: Monday 17 May 2021 14:00
by rgroothuis
THanks, looks like that is indeed the trick, thanks for your always fast response with many solutions. Cheers.