0

I have a script that monitors all log files in a directory, basically tailing, an infinite loop does it. Currently I have one class obj to which i pass the directory and it continuously monitors it. I need to modify the code so that it can monitor multiple directories.

confused between multiprocessing and multithreding in python, each process/thread monitors its own directory. Is passing different class objects to the process/thread a good option.

1 Answers1

0

Multithreading should work fine here. For each new directory that you want to monitor, you can create a new thread. I would advise against having too many threads though, and you can read more on that here, but as long as you don't have a crazy number of threads, you should be fine.

Community
  • 1
  • 1
Eli Sadoff
  • 7,173
  • 6
  • 33
  • 61