TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Logging2, An Improved Python Logging Utility

5 点作者 vforgione大约 8 年前

1 comment

vforgione大约 8 年前
About a year ago I got really fed up with the way the logging library in python works. I was trying to inject request ids (Flask app with a custom before_request hook to create the ids) into every log entry and ran into numerous issues - should it be an adapter, a filter, should I just wrap the logging methods, how will it handle the dynamic injection of the data?<p>Eventually after 4 days of struggling to find the right mixture I settled on a custom adapter and a global instance of a logger and replacing the app logger with it. It was a hack on a hack on a hack. I wan&#x27;t satisfied. (On top of that, we had machines with different timezones, so trying to align our logs later on was a separate mess given the inflexibility of the timestamp formatting).<p>So, I started designing and refining my idea of what a more modern, pythonic logging utility would look like. I&#x27;ve made several iterations on the design and API, and I&#x27;m finally ready to let people take it for a test drive.