use your own logger to avoid logging info from other package
import logging
# Step 1: Set the global logging level to suppress most external logging
logging.basicConfig(level=logging.CRITICAL)
# Step 2: Configure your application's logger for detailed logging
# Assuming 'my_app' is the name or base path of your application's loggers
my_app_logger = logging.getLogger('my_app')
my_app_logger.setLevel(logging.DEBUG) # Or whatever level is appropriate for your app
# Set up a console handler (or any other handler) for your application's logger
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG) # Ensure the handler also uses the desired level
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
console_handler.setFormatter(formatter)
# Add the handler to your application's logger
my_app_logger.addHandler(console_handler)
# Example usage
my_app_logger.debug('This debug message will be printed.')
my_app_logger.info('This info message will be printed.')