pip install logbook python import logbook python logger = logbook.Logger('Concurrent Logger') python python logger.debug('This is a debug message') logger.info('This is an info message') logger.warning('This is a warning message') logger.error('This is an error message') python import logbook import sys logbook.set_thread_mode(logbook.ThreadMode.Synchronous) logbook.StreamHandler(sys.stdout).push_application() logger = logbook.Logger('Concurrent Logger') def worker_thread(): logger.info('Worker thread started') # Perform some work logger.info('Worker thread completed') if __name__ == '__main__': logger.info('Main thread started') worker_logger = logger.bind(thread_id=logbook.current_thread.id) worker_thread() logger.info('Main thread completed')