Monitor filesystem changes in multiple paths and watch live logs, also have full control over
the threads or processes watching for changes. LogRat logs all changes to fsevents_log.log
file in a directory called logs in your current path by default, also in that directory
there is a file named fsevents_analysis.json. This file contains all the changed paths
grouped based on the type of event which occurred in json format, for easier access to
these change logs in case you would like to know what changed and use that path in someway.
- Setting Up A LogRatObserver
- You need to make an instance of
LogRatObseverclass, you can name the instanceobserver_apinot to get you confused. - Call the
create_observermethod of the instance and pass in the path you want to monitor. Also, it takes an optional argumentnamewhich you can set if you want to give your observer a name. The default name is the last directory or file name in your path, finally is returns an observer object. - Pass in the observer object you got from step ii. to the
start_observermethod of the observer class to start the observer.
- You need to make an instance of
It's done, your observer is watching for changes.
- Setting Up an Observer For Multiple Paths
- Make an instance of
LogRatObserverclass, you can name itobserver_api. - Call it's
create_observersmethod and pass in the list of paths you want to monitor, this returns a set of observers. - Pass the observers to the
start_observersmethod. Apart from the observers, it takes an optionalstart_methodargument which specifies the concurrency interface to use in starting the observers. It can be any attribute of theStartMethodsclass. The default isStartMethods.THREADwhich means using threads. Returns an iterable of the threads or processes.
- Make an instance of
And again, your paths are being monitored.
LogRat seems to do what exactly the what watchdog but just added some few other touches
like taking care of multiple paths observing. LogRat is useful when you want to
keep track of files third party programs create on your machine.