Docs: child Logger without a parent uses the root log level since #8842
維護者通常 1 天內回覆
評估
- 難度
- 1/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 85/100
- Issue 類型
- 文件
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- python
研究方向
閱讀 docs/core/logger.md 中的 Child Loggers 章節和 caplog 提示(約第 969 行和第 1153 行)。更新它們,說明不存在父 Logger 時 root logger 的層級,以及測試如何設定層級或建立父 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 小時
- 30 天內合併 PR
- 50
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 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-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 天內回覆