Created
March 8, 2021 10:15
-
-
Save notdodo/c2a170d790cb42fdb4ccc4db3c3f805c to your computer and use it in GitHub Desktop.
Basic script to create a entry on the Windows Event Viewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install pywin32, obviously the script requires admin privs to write to the event logger | |
import logging, logging.handlers | |
def main(): | |
ntl = logging.handlers.NTEventLogHandler("notdodo logging test") | |
logger = logging.getLogger() | |
logger.addHandler(ntl) | |
logger.error("This is a test message") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment