Docs: child Logger without a parent uses the root log level since #8842
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 1/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 85/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Child Loggers セクションと docs/core/logger.md の caplog のヒント(969 行目と 1153 行目付近)を読みます。親 Logger が存在しない場合の root logger のレベルと、テストでレベルを設定する方法、または親を作成する方法を説明するよう更新します。Issue では 3.42.0 のリリースノートを追加することも提案されています。リリースノートの場所を確認し、動作変更を記述します。
索引モデルが issue の本文から書いたものです。
説明
What were you searching in the docs?
How a child Logger behaves in tests when no parent Logger exists, after #8842 (merged, not released yet). I first raised it on the PR: https://github.com/aws-powertools/powertools-lambda-python/pull/8842#issuecomment-7171335297
Is this related to an existing documentation section?
https://docs.aws.amazon.com/powertools/python/latest/core/logger/#child-loggers
How can we improve?
Since #8842, a child Logger without a level stays NOTSET. With no parent Logger in the process, it inherits the root logger's level (WARNING), so logger.info() is dropped. That matches 3.5.0, but on 3.6.0 to 3.41.0 it logged INFO. This test passes on 3.41.0 and fails on develop:
# shared.py
from aws_lambda_powertools import Logger
logger = Logger(service="payment", child=True)
def charge():
logger.info("charged")
# test_shared.py
import shared
def test_charge_logs(caplog):
shared.charge()
assert "charged" in caplog.text
The docs don't cover this case: not the Child Loggers section (docs/core/logger.md line 969), and not the caplog tip under Testing your code (line 1153).
Got a suggestion in mind?
docs/core/logger.mdline 969, add: "If no parent Logger with the sameserviceexists, the child uses the root logger's level (WARNING by default)."- Line 1153, add to the
caplogtip: "If the module under test only defines a child Logger, callcaplog.set_level(logging.INFO)or create the parent Logger inconftest.py." - A line in the 3.42.0 release notes, since users on 3.6.0 or later have only seen INFO.
I can open a PR for the two docs lines. An AI assistant helped me write the test scripts; I ran them on 3.41.0 and develop and checked the output myself.
Acknowledgment
- I understand the final update might be different from my proposed suggestion, or refused.
- 主要言語
- Python
- スター
- 3.3k
- フォーク
- 511
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 50
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws-powertools/powertools-lambda-python のほかの issue
-
Bug: CaseInsensitiveDict (event.headers) returns True for both == and != against the same mappingオープンbug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws-powertools/powertools-lambda-python#8948 ·
メンテナーはふだん 1 日以内に返信
-
Bug: Set-Cookie values passed as a header are comma-joined into one invalid header on HTTP API and Function URL responses対応中かも @saquibjawedbit が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
aws-powertools/powertools-lambda-python#8921 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug: validate() raises raw jmespath ParseError instead of InvalidEnvelopeExpressionError for most malformed envelopes対応中かも @0x5t4l1n が今日担当しました。 オープンbug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
aws-powertools/powertools-lambda-python#8918 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug: SQSRecord.decoded_nested_sns_event raises KeyError on SNS messages delivered to SQS対応中かも @hyeonsang010716 が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
aws-powertools/powertools-lambda-python#8913 ·
メンテナーはふだん 1 日以内に返信
-
Bug: Metrics keeps dimensions and metadata from an invocation that added no metrics対応中かも @hyeonsang010716 が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
aws-powertools/powertools-lambda-python#8911 ·
メンテナーはふだん 1 日以内に返信
aws-powertools/powertools-lambda-python の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
litestar-org/sqlspec#946 ·
メンテナーはふだん 1 日以内に返信
-
area:cli area:docs Platform vdr
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA-NeMo/Gym#7192 ·
メンテナーはふだん 2 日以内に返信
-
SofyaBotオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
ai-robots-txt/ai.robots.txt#324 ·
-
[Resource]: Dashbarオープンresource-submission validation-passed
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
hesreallyhim/awesome-claude-code#3821 · コメント 1 件 ·
-
bug good first issue help wanted level 1 wocs
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
GianlucaBave/murmury#169 ·
メンテナーはふだん 1 日以内に返信