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

Change logger to singleton #564

Merged
merged 6 commits into from
Jun 27, 2024
Merged

Change logger to singleton #564

merged 6 commits into from
Jun 27, 2024

Conversation

callingmedic911
Copy link
Contributor

@callingmedic911 callingmedic911 commented Jun 25, 2024

Closes PRO-722.
This PR moves the logger to singleton, we can keep all tags centrally. Will be needed for the sessionId change I'm doing.

Copy link

changeset-bot bot commented Jun 25, 2024

⚠️ No Changeset found

Latest commit: 30c49a8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

replay-io bot commented Jun 25, 2024

Status Complete ↗︎
Commit 9aaab05
Results
2 Failed
  • clicks a disappearing button
  • should fail on this test
  • 42 Passed
  • adds items
  • adds new items using a custom command
  • adds todos following the fixture
  • adds todos following the fixture
  • adds todos following the fixture
  • adds todos following the fixture
  • calls inform
  • complete all checkbox should update state when items are completed / cleared
  • gets a number
  • only gets a number
  • only gets a number
  • should allow me to add todo items
  • should allow me to clear the complete state of all items
  • should allow me to display active items
  • should allow me to display all items
  • should allow me to display completed items
  • should allow me to edit an item
  • should allow me to mark all items as completed
  • should allow me to mark items as complete
  • should allow me to un-mark items as complete
  • should append new items to the bottom of the list
  • should be hidden when there are no items that are completed
  • should cancel edits on escape
  • should clear text input field when an item is added
  • should display the correct text
  • should display the current number of todo items
  • should focus on the todo input field
  • should hide #main and #footer
  • should hide other controls when editing
  • should highlight the currently applied filter
  • should intercept postman
  • should invoke some commands that have exceptional option handling
  • should log
  • should persist its data
  • should remove completed items when clicked
  • should remove the item if an empty text string was entered
  • should respect the back button
  • should save edits on blur
  • should show #main and #footer when items added
  • should trim entered text
  • should trim text input
  • yields a number
  • @miriambudayr miriambudayr self-requested a review June 26, 2024 17:08
    @@ -71,6 +72,7 @@ class Logger {
    return;
    }

    this.grafana.logger.close();
    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    @miriambudayr I had to add, otherwise, the process wasn't exiting packages/puppeteer/src/first-run.ts.

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Huh, interesting. So basically the CLI process would hang forever?

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    @Andarist also noticed this -> #570

    I'm going to merge and resolve conflicts to unblock this branch from being merged :)

    Copy link
    Contributor

    @bvaughn bvaughn Jun 27, 2024

    Choose a reason for hiding this comment

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

    Noticed that you're calling close before flush here though. Is that intentional?

    If it's important to call both, it seems like flushing before closing would be the expected order. (That's the order @Andarist chose too.)

    I'll resolve the conflicts to accept his ordering for now. If that's a mistake, tag me and I'll follow up! 🙇🏼

    Copy link
    Member

    Choose a reason for hiding this comment

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

    Noticed that you're calling close before flush here though. Is that intentional?

    I specifically chose to call flush before close so we could await the flush. Close also flushes things but it's using a "detached" promise to do that (it's not returned):
    https://github.com/JaniAnttonen/winston-loki/blob/2ed0954e97d85e4be1b81f8d853f1864fa37cf6c/src/batcher.js#L304

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Nice! Good clarification. (Maybe we should add an inline comment with a link to the docs?)

    packages/shared/src/logger/logger.ts Show resolved Hide resolved
    @callingmedic911 callingmedic911 marked this pull request as ready for review June 26, 2024 21:50
    @bvaughn
    Copy link
    Contributor

    bvaughn commented Jun 27, 2024

    Since Miriam approved this PR, I'm going to merge it. Hope that's okay! (Doing this will unblock me to make a small change to the Logger API to simplify the rest of the work I'm trying to do with PRO-720.)

    @bvaughn bvaughn merged commit 6ce3100 into main Jun 27, 2024
    7 checks passed
    @bvaughn bvaughn deleted the aditya/singlton-logger branch June 27, 2024 13:48
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    4 participants