Docs: child Logger without a parent uses the root log level since #8842
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 1/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 85/100
- Type d'issue
- Documentation
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- python
- Domaine
- documentation
Piste de recherche
Lisez la section Child Loggers et le conseil sur caplog dans docs/core/logger.md (vers les lignes 969 et 1153). Mettez-les à jour pour expliquer le niveau du logger racine lorsqu’il n’existe aucun Logger parent et comment les tests peuvent définir le niveau ou créer un parent. L’issue suggère également d’ajouter une note de version pour 3.42.0 ; confirmez l’emplacement des notes de version et documentez le changement de comportement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 3.3k
- Forks
- 511
- Merge moyen
- 2 j 23 h
- PR mergées (30 j)
- 50
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de aws-powertools/powertools-lambda-python
-
Bug: CaseInsensitiveDict (event.headers) returns True for both == and != against the same mappingOuvertebug triage
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
aws-powertools/powertools-lambda-python#8948 ·
Les mainteneurs répondent en général sous 1 jour
-
Bug: Set-Cookie values passed as a header are comma-joined into one invalid header on HTTP API and Function URL responsesPeut-être pris @saquibjawedbit l’a pris il y a 4 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
aws-powertools/powertools-lambda-python#8921 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Bug: validate() raises raw jmespath ParseError instead of InvalidEnvelopeExpressionError for most malformed envelopesPeut-être pris @0x5t4l1n l’a pris aujourd’hui. Ouvertebug triage
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
aws-powertools/powertools-lambda-python#8918 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Bug: SQSRecord.decoded_nested_sns_event raises KeyError on SNS messages delivered to SQSPeut-être pris @hyeonsang010716 l’a pris il y a 7 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
aws-powertools/powertools-lambda-python#8913 ·
Les mainteneurs répondent en général sous 1 jour
-
Bug: Metrics keeps dimensions and metadata from an invocation that added no metricsPeut-être pris @hyeonsang010716 l’a pris il y a 7 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
aws-powertools/powertools-lambda-python#8911 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de aws-powertools/powertools-lambda-python
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
litestar-org/sqlspec#946 ·
Les mainteneurs répondent en général sous 1 jour
-
area:cli area:docs Platform vdr
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
NVIDIA-NeMo/Gym#7192 ·
Les mainteneurs répondent en général sous 2 jours
-
SofyaBotOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
ai-robots-txt/ai.robots.txt#324 ·
-
[Resource]: DashbarOuverteresource-submission validation-passed
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
hesreallyhim/awesome-claude-code#3821 · 1 commentaire ·
-
bug good first issue help wanted level 1 wocs
Difficulté 2/5 1-3 heures Accessibilité débutants 92/100
GianlucaBave/murmury#169 ·
Les mainteneurs répondent en général sous 1 jour