Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Export PowertoolsLogFormatter from /logger #3414

Open
1 of 2 tasks
Myroslav341 opened this issue Dec 12, 2024 · 2 comments
Open
1 of 2 tasks

Feature request: Export PowertoolsLogFormatter from /logger #3414

Myroslav341 opened this issue Dec 12, 2024 · 2 comments
Labels
discussing The issue needs to be discussed, elaborated, or refined feature-request This item refers to a feature request for an existing or new utility logger This item relates to the Logger Utility need-response This item requires a response from a customer and will considered stale after 2 weeks

Comments

@Myroslav341
Copy link

Use case

When creating a custom log formatter, the only way to keep the default baseAttributes shape is to copy the formatting code from PowertoolsLogFormatter.

If PowertoolsLogFormatter is exported on the package level, custom log formatters can inherit from it if needed.

Solution/User Experience

import { LogFormatter, PowertoolsLogFormatter } from '@aws-lambda-powertools/logger'

Alternative solutions

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@Myroslav341 Myroslav341 added feature-request This item refers to a feature request for an existing or new utility triage This item has not been triaged by a maintainer, please wait labels Dec 12, 2024
Copy link

boring-cyborg bot commented Dec 12, 2024

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@dreamorosi
Copy link
Contributor

Hi @Myroslav341, thank you for opening the issue.

Before categorizing the request I'd like to better understand the use case.

In which case you'd want to extend the PowertoolsLogFormatter instead of the LogFormatter class?

The PowertoolsLogFormatter is purposefully note exported because we export the parent class (LogFormatter) for those who want to customize how logs are formatted.

If we exported PowertoolsLogFormatter and you were to extend it, you'd have to format the attributes twice because the formatAttribute method returns an instance of LogItem rather than a plain object.

@dreamorosi dreamorosi added logger This item relates to the Logger Utility discussing The issue needs to be discussed, elaborated, or refined need-response This item requires a response from a customer and will considered stale after 2 weeks and removed triage This item has not been triaged by a maintainer, please wait labels Dec 12, 2024
@dreamorosi dreamorosi moved this from Triage to On hold in Powertools for AWS Lambda (TypeScript) Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussing The issue needs to be discussed, elaborated, or refined feature-request This item refers to a feature request for an existing or new utility logger This item relates to the Logger Utility need-response This item requires a response from a customer and will considered stale after 2 weeks
Projects
Development

No branches or pull requests

2 participants