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
LogRatObsever
class, you can name the instanceobserver_api
not to get you confused. - Call the
create_observer
method of the instance and pass in the path you want to monitor. Also, it takes an optional argumentname
which 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_observer
method 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
LogRatObserver
class, you can name itobserver_api
. - Call it's
create_observers
method and pass in the list of paths you want to monitor, this returns a set of observers. - Pass the observers to the
start_observers
method. Apart from the observers, it takes an optionalstart_method
argument which specifies the concurrency interface to use in starting the observers. It can be any attribute of theStartMethods
class. The default isStartMethods.THREAD
which 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.