Repository navigation
Description
Warning
For contributors, human or agent. Comment here to claim this issue and wait for the assignment before opening a PR; if two PRs show up, the assignee's stays. AI-assisted work is welcome, say so in the PR and tell us how you verified it: run the tests yourself and paste what you saw, do not describe runs you did not do. Read AGENTS.md first, it has the commands and the rules the CI enforces. This goes into 3.42.0.
Expected Behaviour
Every way of emitting a record through the Powertools Logger takes part in buffering the same way: a record below the threshold is buffered, an error-level record flushes when flush_on_error_log is on.
Current Behaviour
log(), fatal() and warn() are reached through Logger.__getattr__ and go straight to the stdlib logger. logger.log(logging.DEBUG, ...) emits immediately while logger.debug() buffers; logger.fatal() does not flush the buffer while logger.critical() does.
Code snippet
import logging
from aws_lambda_powertools import Logger
from aws_lambda_powertools.logging.buffer import LoggerBufferConfig
logger = Logger(service="x", level="DEBUG", buffer_config=LoggerBufferConfig(flush_on_error_log=True))
logger.log(logging.DEBUG, "via log()") # printed immediately, debug() would buffer
logger.debug("buffered")
logger.fatal("boom") # buffer not flushed, critical() would flushPossible Solution
In aws_lambda_powertools/logging/logger.py, implement log() on the same dispatch the explicit methods use and alias fatal to critical and warn to warning. The audit also notes that debug, info and warning repeat the same thirty-line buffering block three times; a single _log(level, ...) dispatcher removes the duplication and fixes this at the same time. Item 10 of the audit plus the first cleanup item.
Item 10 of the Logger audit in #8730, re-verified on develop today. Functional tests go through the public Logger API only.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.13
Packaging format used
PyPi
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsComing soon
Activity
Neeraj111010 commentedon Nov 15, 2026
Hi @leandrodamascena i would like to take this
leandrodamascena commentedon Nov 15, 2026
Yours @Neeraj111010. Two parts:
log()on the same dispatch as the explicit methods,fatal/warnas aliases, and the_logdispatcher that removes the three copies of the buffering block. Keep every existing buffer test green, that is the safety net for the refactor.dhaiirryyaa commentedon Nov 18, 2026
Hi @leandrodamascena @Neeraj111010, checking in to see if this is still being worked on. If Neeraj is unavailable or busy, I'd be happy to take this over and submit a PR with the
_log()dispatcher,log()method,fatal/warnaliases, and unit tests.test(logger): add coverage for string and invalid log levels in logge…
leandrodamascena commentedon Nov 20, 2026
@Neeraj111010 I haven't heard back in five days and #8871 is already up, so I'm moving the assignment to @dhaiirryyaa to keep 3.42.0 on track. No hard feelings, and if you were midway through it, say so and I'll find you another one from the Logger batch.
fix(logger): route log, warn, and fatal through buffer dispatch (#8871)
powertools-for-aws-oss-automation commentedon Nov 25, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.