Add `AnyLogger` type (`Logger | LoggerAdapter` alias)
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Feature or enhancement
Proposal:
AnyLogger: TypeAlias = Logger | LoggerAdapter
According to the docs, LoggerAdapter should look mostly like Logger. So it would be really nice to have a type that can be used for both Logger and LoggerAdapter.
I would need it when I want to hold a logger instance, but I don't really care if it's Logger or LoggerAdapter.
So I want to support both options.
It may sound like an antipattern, according to the docs, but using LoggerAdapter is the recommended way of passing contextual info (according to the docs).
Even when using contextvars for holding the logger, a AnyLogger type would be handy indeed.
I am willing to submit a PR fixing this issue, like I tried to do before:
https://github.com/python/cpython/pull/126057
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
logging モジュールの Logger と LoggerAdapter のエントリポイントから始め、issue に示されている提案された TypeAlias を確認します。実装の背景を把握するために以前の pull request を確認し、そのうえで、結果として得られる型が両方の logger の形式をカバーし、ドキュメント化された動作を変更しないことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- 機能追加
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100