-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-135852: Remove out of tree pywin32 dependency for NTEventLogHandler #137860
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the test fails :)
Sorry, I forgot to check the CI result after the push. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR @aisk. It look interesting.
Could you please show how can this be used in NTEventLogHandler
? Maybe not in this PR, but in a separate PR created on top of this?
Co-authored-by: Serhiy Storchaka <[email protected]>
Thanks for the view! I'll create another PR based on this to try to implement the whole feature in the original issue. |
@serhiy-storchaka Hi, I found that using this in |
Please note that the
lpUserSid
parameter in ReportEvent don't added because it needs passing a new struct from Python to it, and we don't need this parameter for the usage of implementNTEventLogHandler
. If we want add it in the future, we can add it as kwargs.Docuements for these functions:
For the
NTEventLogHandler
, there is a implementation detail:The old implementation based on
pywin32
, ifdllname
is not specified,pywin32
will using a vendored dll in that package, as a log template for the NT event log system.For the new implement in this PR, if the
dllname
is not specified, I decided not to register the dll. As a result, the log still can be send to the NT Event Log System, we can see it in the Event Viewer.But the event will show some thing like this (I just use a picture from the Internet because I'm using a localized Windows which the text is Chinese but they are the same thing):
And I think it's OK because we can check the Detail tab to see the original message, for develop purpose this is enough. For users with production usage, they can provide their own dlls as the message template.
logging.handlers.NTEventLogHandler
#135852