A handler for safely and efficiently using the logging module in an MPI task.