Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EventGhost] - Enhancement - Log.py, Upgrades the debug logging #249

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kdschlosser
Copy link
Member

Changes the debug logging to find the name of the calling module and if it is a plugin it will create a new file specifically for that plugin. Provides alittle more organization to the debug logging. It also houses all of the log files into a folder called logs in %appdata%\EventGhost.

It also fixes the issue of not having the debug header information added if the user has logging turned on from inside of the GUI. and I added the Windows version, Windows major, minor, build version, the start time of EG is all added to this header also. The header is added to each new file that is made or appended to one that is already existing. It closes the file after each write to it so it can be deleted without the need to shutdown EG.

If there happen to be any error during the load of EG this information will be written to the standard Log.txt file. and anything that is not a plugin that is writing log information is written to Core.txt in the logs folder.

Changes the debug logging to find the name of the calling module and if it is a plugin it will create a new file specifically for that plugin. Provides alittle more organization to the debug logging.
Copy link
Contributor

@topic2k topic2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personaly don't like to have the log splitted, but that's just me. Don't know what others say. I hope we get some more comments.

'Windows Version: %s' % ' '.join(
list(platform.win32_ver())
),
'Computer Name: %s' % platform.node(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need the computer name for debugging?

),
'Python Compiler: %s' % platform.python_compiler(),
'Python Build Date: %s' % (
platform.python_build()[1],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing the info that it's stackless python, so i would just use sys.version. It returns '2.7.12 Stackless 3.1b3 060516 (default, Oct 31 2016, 18:42:08) [MSC v.1500 32 bit (Intel)]'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok can do
I'll do it right now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you like the way it works tho? I likle it alot better. it is a pain in the backside to sift through a debug log file when you are looking for something that is specific to a plugin. This is a nice way to handle it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe if i would use EG more then i would find it more usefull :D but i will merge it anyway ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all done.

Adds the Stackless version to the log header
if split logging is to be used the config.py file needs to be edited and the line splitDebuggingLog = True needs to be added to it in order to turn on this feature.

added for printing the header information to the original Log output. 
removed the computer name from the header.
@kdschlosser
Copy link
Member Author

corrected the python version.
removed the computer name.

added the ability to turn on or off the slpit logging via adding a line to the config.py file

splitDebuggingLog = True

made it so that each time the debugging log is turned on or off it will set a flag for printing the header to the original Log.txt

@kdschlosser
Copy link
Member Author

Oh and this will only split off the plugins and nothing else. I am not usually one for split logs either. But when i specifically am looking for output form a plugin i am working on it's an annoyance to have to go reading through a large log and this way I am also able to only delete that plugins log.

@topic2k
Copy link
Contributor

topic2k commented Jun 28, 2017

Thanks for adding the split option 😃
Anything else you want to add, or is it ready to merge?

@kdschlosser
Copy link
Member Author

I do not think anything else needs to be added. just want to make sure it works 100% because it does have some voodoo code to it. and that is not my favorite kind of code. but it's the only way to do it without adding a method to the plugin base. and then having the plugin devs update their plugins to support it. so i though this would be a better way

@topic2k
Copy link
Contributor

topic2k commented Jun 28, 2017

Now EG only works if i have splitDebuggingLog = True. If i set it to False or omit it, then EG hangs. After some trying it seems that the logging crashes if the logs directory doesn't exists.

Had to move eg.Config being initiliazed to before eg.Log due to the log needing an attribute from eg.config. 

Also did some code optimization. and removed the use of os to get the appdata folder.
@kdschlosser
Copy link
Member Author

i just wanted to let you know this one should be fixed. i forgot to mention it. i did a commit a while back

@topic2k
Copy link
Contributor

topic2k commented Jul 2, 2017

well, sorry to say no. I've deleted Appdata\EventGhost and then run EG with -debug option. The GUI doesn't show up, the process seems to hang and a log file with only File "C:\Users\topic\AppData\Roaming\EventGhost\config.py" does not exist. as content is created. After while the EG process exits.
If i run EG without debug option it starts normally.

@kdschlosser
Copy link
Member Author

after it runs normally if you then close EG and restart it with the -debug parameter does it work then?

@topic2k
Copy link
Contributor

topic2k commented Jul 3, 2017

No, makes no different if i run it successfully before using -debug.

@topic2k topic2k added this to the v0.6 milestone Jul 10, 2017
@per1234 per1234 removed their request for review March 9, 2021 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants