I wrote a script that subscribes to the DocumentChanged Event in order to display information to the user. I am trying to use the provided pyRevit logger from the script module inside my function.
When I run any of my other scripts, this event function stops logging to the output window. The function still executes as normal, but stops printing my warnings.
Below is an example code that would be in the
startup.py file. Unfortunately for me, everything needs to stay inside the
startup.py file because my script doesn’t work in the
doc-changed.py hook otherwise.
logger = script.get_logger() class App: def __init__(self, logger): self.logger = logger def func(self, sender, args): self.logger.warning("logging working") UI.TaskDialog.Show("func", "working") # subscribe to the document changed event HOST_APP.app.DocumentChanged += framework.EventHandler[ DB.Events.DocumentChangedEventArgs ](App(logger).func)