Skip to content

Instantly share code, notes, and snippets.

@notdodo
Created March 8, 2021 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notdodo/c2a170d790cb42fdb4ccc4db3c3f805c to your computer and use it in GitHub Desktop.
Save notdodo/c2a170d790cb42fdb4ccc4db3c3f805c to your computer and use it in GitHub Desktop.
Basic script to create a entry on the Windows Event Viewer
# 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