Domotic.Log method for python plugin framework and domoticz log levels

Python and python framework
Post Reply
EscApe
Posts: 73
Joined: Thursday 02 April 2015 8:46
Target OS: Raspberry Pi
Domoticz version: v3+beta
Location: The Netherlands
Contact:

Domotic.Log method for python plugin framework and domoticz log levels

Post by EscApe » Thursday 10 May 2018 13:08

Hi,

I'm running the domoticz service with -loglevel 1, which should show error and status messages. With this setting anything from within a python plugin except Domoticz.Error is ignored. Even when i set the plugin to debug mode "Domoticz.Debugging(1)".

Is there a way to generate a status message from a python plugin, so they will show with -loglevel 1? Or could different log levels be implemented for python plugins?

Use cases:
My Presence detection plugin logs when devices leave or arrive. I would like to see these messages in my log, but i do not want to enable the overall -loglevel 0 for domoticz, because that will flood my log with events from energy meters (P1), z-wave devices and other less important information.

If i (purposely) enable debug mode on a plugin i would like to see debug logging, regardless of the overall domoticz log setting.

User avatar
Dnpwwo
Posts: 705
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Domotic.Log method for python plugin framework and domoticz log levels

Post by Dnpwwo » Sunday 13 May 2018 7:12

@EscApe,

Couple of things, "Domoticz.Debugging(1)" is pretty verbose these days but the call now accepts a mask that will allow you to select what you see.

I'm reluctant to ignore things like the domoticz loglevel setting because one of the things I wanted to achieve with the plugins was to make them indistinguishable from either C++ brethern.

I added a 'Status' function to the Python API today (see https://www.domoticz.com/wiki/Developin ... llable_API) which may give you what you want.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw

EscApe
Posts: 73
Joined: Thursday 02 April 2015 8:46
Target OS: Raspberry Pi
Domoticz version: v3+beta
Location: The Netherlands
Contact:

Re: Domotic.Log method for python plugin framework and domoticz log levels

Post by EscApe » Sunday 13 May 2018 13:09

@Dnpwwo,

That's exactly what i was asking for (or at least tried to explain;-)). Just compiled and modified my plugin, and its working like a charm.

Thanks!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests