Print text to Event Log

Posted on
Mon Jul 20, 2020 2:44 pm
jltnol offline
Posts: 492
Joined: Oct 15, 2013

Print text to Event Log

Assuming this is actually possible, I'm looking for a way to print certain text to the Event log.

I looked here https://pythonexamples.org/python-print-string-console-example/, and have searched the Python forum for "Print to Log", but haven't found anything. I have tried just this:

Code: Select all
print(hello!)
and
Code: Select all
print('Hello World!')

but using just the print command doesn't work.This would be part of a bigger Python script, and mainly want to notate when certain things happen in the log that is easier for me to look for.

Posted on
Mon Jul 20, 2020 2:49 pm
matt (support) offline
Site Admin
User avatar
Posts: 20075
Joined: Jan 27, 2003
Location: Texas

Re: Print text to Event Log

Presuming it is an embedded Indigo script or an external Indigo python script (being directly executed in an Indigo Action), then you'll want to use:

Code: Select all
indigo.server.log("Hello world!")

Image

Posted on
Mon Jul 20, 2020 3:59 pm
jltnol offline
Posts: 492
Joined: Oct 15, 2013

Re: Print text to Event Log

Hey Matt

Was sure it would be something easy.

thanks for your help.

Posted on
Mon Jul 20, 2020 7:59 pm
mclass offline
Posts: 229
Joined: May 13, 2015
Location: Melbourne, Australia

Re: Print text to Event Log

On a similar note, is it possible to change the colour of text in the log - I note some messages appear in red and green?


Sent from my iPad using Tapatalk

Posted on
Tue Jul 21, 2020 11:37 am
matt (support) offline
Site Admin
User avatar
Posts: 20075
Joined: Jan 27, 2003
Location: Texas

Re: Print text to Event Log

You can set isError=True as an optional argument and it will show in red. There is an example here.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests

cron