Skip to content

feat(logger): Enable log buffering feature #3641

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

Merged
merged 9 commits into from
Feb 25, 2025

Conversation

ConnorKirk
Copy link
Contributor

@ConnorKirk ConnorKirk commented Feb 21, 2025

Summary

This PR enables the buffering feature for the logger utility.
It allows the user to configure the buffering functionality in the logger constructor.

The core of this PR is adding allow the behaviour of log buffering to be configured.

Changes

  1. Add logBufferOptions object to the Logger config
  2. Enable log buffering by default
  3. Make flushBuffer method public

Please provide a summary of what's being changed

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: closes #3634


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@boring-cyborg boring-cyborg bot added logger This item relates to the Logger Utility tests PRs that add or change tests labels Feb 21, 2025
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Feb 21, 2025
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is going well, thank you for working on it.

I've left a handful of comments, but we're definitely in the right direction.

@ConnorKirk ConnorKirk force-pushed the 3634-log-buffering-config branch from 0cc4096 to d7bf789 Compare February 24, 2025 17:16
@dreamorosi
Copy link
Contributor

@ConnorKirk
Copy link
Contributor Author

One clarifying question - If a user provides the logBufferOptions object in the Logger config, but does not specify "enabled": true, should buffering be enabled?

At the moment, buffering is disabled unless explicitly enabled, even if the rest of the log buffering object is provided.

This commit enables the buffering feature for the logger utility
It allows the user to configure the buffering functionality in the
logger constructor.
@ConnorKirk ConnorKirk force-pushed the 3634-log-buffering-config branch from 35e6487 to 6c3bac7 Compare February 25, 2025 10:11
@dreamorosi
Copy link
Contributor

One clarifying question - If a user provides the logBufferOptions object in the Logger config, but does not specify "enabled": true, should buffering be enabled?

At the moment, buffering is disabled unless explicitly enabled, even if the rest of the log buffering object is provided.

Yes, it should be enabled whenever logBufferOptions is provided, and disabled when logBufferOptions is undefined or defined and logBufferOptions.enabled is false.

@dreamorosi dreamorosi self-requested a review February 25, 2025 11:08
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the work on this PR, let's merge it!

@dreamorosi dreamorosi marked this pull request as ready for review February 25, 2025 11:27
@dreamorosi dreamorosi requested review from a team as code owners February 25, 2025 11:27
@dreamorosi dreamorosi requested a review from am29d February 25, 2025 11:27
@dreamorosi dreamorosi merged commit 8203016 into aws-powertools:main Feb 25, 2025
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logger This item relates to the Logger Utility size/L PRs between 100-499 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: allow enabling log buffering via constructor
2 participants