How to change logging category?

Posted on
Sun Dec 18, 2016 6:28 pm
ryanbuckner offline
Posts: 280
Joined: Oct 08, 2011

How to change logging category?

In python, how do I change the category when logging?

For example, this developer set it to "Alexa-Hue Bridge"

Code: Select all
   Alexa-Hue Bridge                + Publishing device 'Master Bathroom Lights' to Alexa
   Alexa-Hue Bridge                + Publishing device 'Play Room Lights' to Alexa
   Alexa-Hue Bridge                + Publishing device 'TV Lights' to Alexa
   Alexa-Hue Bridge                + Publishing device 'Television' to Alexa

Posted on
Mon Dec 19, 2016 12:15 pm
jay (support) offline
Site Admin
User avatar
Posts: 15880
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to change logging category?

Anything a plugin writes to the Indigo log will automatically get the name of the plugin as the log type.

You can, however, use the type argument to the log method to set it to something else:

Code: Select all
indigo.server.log("Text to log", type="Some Type")

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Dec 19, 2016 4:21 pm
ryanbuckner offline
Posts: 280
Joined: Oct 08, 2011

Re: How to change logging category?

Thanks Jay

Posted on
Fri Dec 23, 2016 10:13 am
ryanbuckner offline
Posts: 280
Joined: Oct 08, 2011

Re: How to change logging category?

Code: Select all
 
 Script Error                    bmwpostv1.py: invalid syntax
   Script Error                    around line 26 - "indigo.server.log(status, type=“BMW Plugin”)"


Looks like that throws an error

Here's the code:

Code: Select all
indigo.server.log(u"Executing " + service)
resp = c.executeService(vin, service)
status = resp['executionStatus']['status']
while status in ('INITIATED','PENDING'):
    if sendStatus:
        indigo.server.log(status, type="BMW Plugin")
        sendStatus = False
    time.sleep(5)
    check = c.call('/user/vehicles/{}/serviceExecutionStatus?serviceType={}'.format(vin, service))
    status = check['executionStatus']['status']

Posted on
Fri Dec 23, 2016 11:06 am
autolog offline
Posts: 3008
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT+1]

Re: How to change logging category?

Have you mixed up tabs and spaces for your indents, that will cause a problem if you have.
The indigo log statement looks OK to me. :)

Posted on
Fri Dec 23, 2016 3:01 pm
FlyingDiver offline
Posts: 3614
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: How to change logging category?

It appears, from the error statement, that you're using fancy quotes, not simple double quotes. Check that.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Dec 23, 2016 3:06 pm
autolog offline
Posts: 3008
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT+1]

Re: How to change logging category?

FlyingDiver wrote:
It appears, from the error statement, that you're using fancy quotes, not simple double quotes. Check that.

Your eyesight is obviously better than mine :shock: - well spotted! :)

Posted on
Fri Dec 23, 2016 3:07 pm
FlyingDiver offline
Posts: 3614
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: How to change logging category?

autolog wrote:
FlyingDiver wrote:
It appears, from the error statement, that you're using fancy quotes, not simple double quotes. Check that.

Your eyesight is obviously better than mine :shock: - well spotted! :)


Been bit by that way too many times. Finally figured out what was causing it. Some weird interaction with international keyboard input when I had both US and GB keyboards enabled on my iMac.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Dec 23, 2016 6:45 pm
ryanbuckner offline
Posts: 280
Joined: Oct 08, 2011

Re: How to change logging category?

FlyingDiver wrote:
It appears, from the error statement, that you're using fancy quotes, not simple double quotes. Check that.


That was it. Thanks ! !

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest