title: watchdog monitoring file for changes
body: <p>I have a need to watch a log file for changes.  After looking through stackoverflow questions, I see people recommending <code>watchdog</code>.  So I'm trying to test, and am not sure where to add the code for when files change:</p>
  <pre class="lang-py prettyprint-override"><code>import time
  from watchdog.observers import Observer
  from watchdog.events import LoggingEventHandler
  
  if __name__ == &quot;__main__&quot;:
      event_handler = LoggingEventHandler()
      observer = Observer()
      observer.schedule(event_handler, path='.', recursive=False)
      observer.start()
      try:
          while True:
              time.sleep(1)
          else:
              print &quot;got it&quot;
      except KeyboardInterrupt:
          observer.stop()
      observer.join()
  </code></pre>
  <p>Where do I add the &quot;got it&quot; — in the <code>while</code> loop if the files have been added/changed?</p>