Skip to content

improv(logger): streamline Logger types #3054

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
Sep 13, 2024
Merged

Conversation

dreamorosi
Copy link
Contributor

@dreamorosi dreamorosi commented Sep 12, 2024

Summary

Changes

Please provide a summary of what's being changed

I started working on this PR to improve the work merged in #2736 and provide a better DX for customers using the feature.

The main goal was to have TypeScript suggest the possible values for log keys as well as accept arbitrary strings.

While working on this improvement, which I achieved (see screenshot below), I quickly realized that the types for the Logger had become convoluted.

image

Most of the types were not documented, and especially the types around log keys and contents of a log had become confused.

In this PR I have refactored, reorganized, and documented all the types for the Logger class - as well as some methods - to ensure that each one of them provides useful info for customers and maintainers alike.

The internal logic of the Logger remains unchanged, however due to having added many new comment blocks, the diff seems abnormally larger than it really is.

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

Issue number: closes #3053


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.

@dreamorosi dreamorosi self-assigned this Sep 12, 2024
@dreamorosi dreamorosi requested a review from a team September 12, 2024 16:38
@dreamorosi dreamorosi requested a review from a team as a code owner September 12, 2024 16:38
@boring-cyborg boring-cyborg bot added logger This item relates to the Logger Utility tests PRs that add or change tests labels Sep 12, 2024
@pull-request-size pull-request-size bot added the size/XXL PRs with 1K+ LOC, largely documentation related label Sep 12, 2024
@github-actions github-actions bot added the enhancement PRs that introduce minor changes, usually to existing features label Sep 12, 2024
@leandrodamascena
Copy link
Contributor

I'll start reviewing it tomorrow morning and this will take longer to complete.

If @am29d approves it before then, please go ahead and merge.

@dreamorosi
Copy link
Contributor Author

No rush - thank you!

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

Hi @dreamorosi! I made some small changes to the text/docstring to make it clearer for users. In this PR I didn't look too much at TypeScript code itself and things you renamed or moved from here to there, because that seems fine and you have much more context.

I tested this code locally and saw that the IDE hints are working as expected.

I'll ask for a Request Changes so you can check if the changes make sense.

Copy link

@dreamorosi dreamorosi merged commit db26958 into main Sep 13, 2024
11 checks passed
@dreamorosi dreamorosi deleted the improv/logger_types branch September 13, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PRs that introduce minor changes, usually to existing features logger This item relates to the Logger Utility size/XXL PRs with 1K+ LOC, largely documentation related tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: improve type hints when using log reordering feature
2 participants