最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Suppressing Logging From PackageModule when `logging` is used directly - Stack Overflow

programmeradmin5浏览0评论

I am using the pdf2docx package Gitub in python and it looks like in the converter module, they use logging directly instead of using a logger like

logger = logger.getLogger(__name__)

The logging.basicConfig in converter is set to logging.INFO and is propagating these horrible logs on. Is it impossible to suppress them because they use logging directly?

I am using the pdf2docx package Gitub in python and it looks like in the converter module, they use logging directly instead of using a logger like

logger = logger.getLogger(__name__)

The logging.basicConfig in converter is set to logging.INFO and is propagating these horrible logs on. Is it impossible to suppress them because they use logging directly?

Share Improve this question edited 11 hours ago swygerts asked 12 hours ago swygertsswygerts 2254 silver badges18 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Create a default catchall root logger object and tell it to be silent:

rootLogger = logging.getLogger("")
rootLogger.disabled = True
rootLogger.propagate = False

Direct calls to logging will inherit these settings.

发布评论

评论列表(0)

  1. 暂无评论