There are several worker threads that must process data quickly. At the same time, the threads log to files. The threads should not be idle when writing to a file, so a separate thread should output logs to a file.

Workers-Loggers-Files.drawio

Structure of a Python program using classes from the logging module.

loggers-listener-filehandlers