You can create custom logging filters by subclassing logging.Filter and adding it to your logger to control what gets logged.