Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
log events to file
log events to file
I have been using EG now for a while, and am increasingly happy with the possibilities, discovering new things all the time.
The one thing that I have been looking for with no result is a way to log events into a file, which I can later use for analysis. In fact, if I can save and access the log at the left half of the screen, then that would cover it.
Seems like a basic thing, so I can't imagine that there is nothing to do this... I must be looking in the wrong plugins.
Can anyone point me in the right direction?
The one thing that I have been looking for with no result is a way to log events into a file, which I can later use for analysis. In fact, if I can save and access the log at the left half of the screen, then that would cover it.
Seems like a basic thing, so I can't imagine that there is nothing to do this... I must be looking in the wrong plugins.
Can anyone point me in the right direction?
Re: log events to file
Select the first event in the log, scroll to the bottom, hold shift and click the last event. Right click > Copy. Paste to notepad.manjh wrote:I have been using EG now for a while, and am increasingly happy with the possibilities, discovering new things all the time.
The one thing that I have been looking for with no result is a way to log events into a file, which I can later use for analysis. In fact, if I can save and access the log at the left half of the screen, then that would cover it.
Seems like a basic thing, so I can't imagine that there is nothing to do this... I must be looking in the wrong plugins.
Can anyone point me in the right direction?
Re: log events to file
Thanks for your reply, but that wasn't quite what I was looking for.LaTropa64 wrote:Select the first event in the log, scroll to the bottom, hold shift and click the last event. Right click > Copy. Paste to notepad.manjh wrote:I have been using EG now for a while, and am increasingly happy with the possibilities, discovering new things all the time.
The one thing that I have been looking for with no result is a way to log events into a file, which I can later use for analysis. In fact, if I can save and access the log at the left half of the screen, then that would cover it.
Seems like a basic thing, so I can't imagine that there is nothing to do this... I must be looking in the wrong plugins.
Can anyone point me in the right direction?
I wanted to log events automatically and selectively. For instance, I want to log the date/time that my door open sensors send a signal. If I could trigger a "log record" into a file from within a macro, I could do what I intended...
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: log events to file
Well, I would write a small plugin that should
- have settings for which type of events you are interested in (with wildcards)
- write those to a logfile (ev with settings for format/path/name and type (txt, html))
Capturing events in python is not so difficult. Writing to a log file is also simple. Making a plugin is not so hard either
In many plugins you actually can find examples of what you are asking for. Maybe your effort can be reduced to some smart copy & paste exercise
Look at some plugins already made by all authors
Best regards, Walter
- have settings for which type of events you are interested in (with wildcards)
- write those to a logfile (ev with settings for format/path/name and type (txt, html))
Capturing events in python is not so difficult. Writing to a log file is also simple. Making a plugin is not so hard either
In many plugins you actually can find examples of what you are asking for. Maybe your effort can be reduced to some smart copy & paste exercise
Look at some plugins already made by all authors
Best regards, Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: log events to file
Oops.... there is a plugin called File Operations that does just that.
Teaches me to look a bit deeper before asking.
Teaches me to look a bit deeper before asking.
Re: log events to file
I've been playing around with the file operations plugin, and would like to write some data to a file.
One of my events comes from a micro processor, and after the event identifier it carries some data that I need to log.
I suspected a variable "payload" or "input", or something alike, but no luck.
The only variable I found that works, is "eg.result". But that gives me meta-information about the USB link that the event came in across, and nothing about the data in the event itself.
Is there a way to capture that data into the file operation, without actually going into plugin-writing?
One of my events comes from a micro processor, and after the event identifier it carries some data that I need to log.
I suspected a variable "payload" or "input", or something alike, but no luck.
The only variable I found that works, is "eg.result". But that gives me meta-information about the USB link that the event came in across, and nothing about the data in the event itself.
Is there a way to capture that data into the file operation, without actually going into plugin-writing?
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: log events to file
Hi, maybe something like this can help you
Best regards, Walter
I created a simple setup here with a macro holding two actions and a python script (see picture)
When an event is received that matches, the python script executes and logs the event to a html-file
The script looks like this:
Best regards, Walter
I created a simple setup here with a macro holding two actions and a python script (see picture)
When an event is received that matches, the python script executes and logs the event to a html-file
The script looks like this:
Code: Select all
import time, os, sys
def LogToFile(s):
majorVersion = sys.getwindowsversion()[0:2]
timeStamp = str(
time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
)
logStr = timeStamp+"\t"+s+"<br\n>"
if majorVersion > 5:
progData = os.environ['ALLUSERSPROFILE']
if not os.path.exists(progData+"/EventGhost/Log") and not os.path.isdir(progData+"/EventGhost/Log"):
os.makedirs(progData+"/EventGhost/Log")
fileHandle = open (progData+'/EventGhost/Log/MyLog.html', 'a' )
fileHandle.write ( logStr )
fileHandle.close ()
else:
if not os.path.exists('Log') and not os.path.isdir('Log'):
os.mkdir('Log')
fileHandle = open ( 'Log/MyLog.html', 'a' )
fileHandle.write ( logStr )
fileHandle.close ()
LogToFile(eg.event.string+"|||"+str(eg.event.payload))
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: log events to file
Before I start, apologies for being new to this Python stuff...krambriw wrote:Hi, maybe something like this can help you
I created a macro with the Python script as you provided, and EG gives me this at startup:
I linked the middle mouse button as an event to the macro, and when I press it, this shows up:Error compiling script.
Traceback (most recent call last) (1076):
File "C:\temp\EventGhost\eg\Classes\ActionItem.py", line 149, in SetArgs
File "C:\temp\EventGhost\plugins\EventGhost\PythonScript.py", line 76, in __init__
File "C:\temp\EventGhost\plugins\EventGhost\PythonScript.py", line 102, in PrintTraceback
AttributeError: 'NoneType' object has no attribute 'PrintError'
I'm sure it is something obvious that I missed, but what is wrong?Mouse.MiddleButton
Python Script
Python Script
Error in Action: "Python Script"
Traceback (most recent call last) (1076):
TypeError: 'NoneType' object is not callable
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: log events to file
Very strange...I do not think it is the script itself that crashes (no such line numbers and variable names in the script)
Make a new simple setup with EG and try again
Best regards, Walter
Make a new simple setup with EG and try again
Best regards, Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: log events to file
I gave up when I found out I can do just what I want with the File Operations plugin, using variable eg.event.string and writing that to a file.
I did notice, however, that the filename has to be filled in as a "real" filename.
I tried assigning the name to a global variable and use that in the outputfile field, but that is not resolved.
I did notice, however, that the filename has to be filled in as a "real" filename.
I tried assigning the name to a global variable and use that in the outputfile field, but that is not resolved.
-
confirmator
- Posts: 22
- Joined: Sat Apr 05, 2008 7:10 pm
Re: log events to file
Is there a variable which would return anything that gets written in the log, instead of just events like eg.event.string?
I am trying to chase down a bug that apparently only appears when EG is minimized to tray, so a full log might be conclusive.
But I haven't found a way to have EG write its full log to disk :/
I am trying to chase down a bug that apparently only appears when EG is minimized to tray, so a full log might be conclusive.
But I haven't found a way to have EG write its full log to disk :/