Docs: child Logger without a parent uses the root log level since #8842
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 85/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- documentation
Hướng nghiên cứu
Đọc phần Child Loggers và mẹo về caplog trong docs/core/logger.md (khoảng dòng 969 và 1153). Cập nhật chúng để giải thích mức của root logger khi không có Logger cha và cách các bài kiểm thử có thể đặt mức hoặc tạo một Logger cha. Issue cũng đề xuất thêm ghi chú phát hành cho 3.42.0; hãy xác nhận vị trí của ghi chú phát hành và ghi lại thay đổi hành vi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 3.3k
- Fork
- 511
- Merge trung bình
- 2 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 50
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws-powertools/powertools-lambda-python
-
Bug: CaseInsensitiveDict (event.headers) returns True for both == and != against the same mappingĐang mởbug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws-powertools/powertools-lambda-python#8948 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: Set-Cookie values passed as a header are comma-joined into one invalid header on HTTP API and Function URL responsesCó thể đã có người làm @saquibjawedbit đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
aws-powertools/powertools-lambda-python#8921 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: validate() raises raw jmespath ParseError instead of InvalidEnvelopeExpressionError for most malformed envelopesCó thể đã có người làm @0x5t4l1n đã nhận hôm nay. Đang mởbug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
aws-powertools/powertools-lambda-python#8918 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: SQSRecord.decoded_nested_sns_event raises KeyError on SNS messages delivered to SQSCó thể đã có người làm @hyeonsang010716 đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
aws-powertools/powertools-lambda-python#8913 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: Metrics keeps dimensions and metadata from an invocation that added no metricsCó thể đã có người làm @hyeonsang010716 đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
aws-powertools/powertools-lambda-python#8911 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws-powertools/powertools-lambda-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
litestar-org/sqlspec#946 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cli area:docs Platform vdr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA-NeMo/Gym#7192 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
SofyaBotĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
ai-robots-txt/ai.robots.txt#324 ·
-
[Resource]: DashbarĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
hesreallyhim/awesome-claude-code#3821 · 1 bình luận ·
-
bug good first issue help wanted level 1 wocs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
GianlucaBave/murmury#169 ·
Maintainer thường phản hồi trong vòng 1 ngày