Currently both the MultiThreadedAugmenter and NonDetMultiThreadedAugmenter classes use the root logger to print logs to the console. Calling logging.debug() implicitly creates a new stream handler for the root logger. This is problematic in cases where the user is already using their own logger with its own stream handler. Messages are printed once by the user's logger, and then echoed by the root logger. The solution is simply to create a new logger for the batchgenerators package, and then use that logger to print relevant messages to stdout. For example a logger.py file could contain:
Then to print logs to stdout in other files such as multi_threaded_augmenter.py
from logger import log
from logging import INFO, DEBUG
# Something happens in the code
log('A message about what happened')
log(INFO, 'This is an info message instead of default DEBUG message')
Currently both the MultiThreadedAugmenter and NonDetMultiThreadedAugmenter classes use the root logger to print logs to the console. Calling logging.debug() implicitly creates a new stream handler for the root logger. This is problematic in cases where the user is already using their own logger with its own stream handler. Messages are printed once by the user's logger, and then echoed by the root logger. The solution is simply to create a new logger for the batchgenerators package, and then use that logger to print relevant messages to stdout. For example a logger.py file could contain:
Then to print logs to stdout in other files such as multi_threaded_augmenter.py