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

Refactor logger to be event-based #13

Closed
wants to merge 5 commits into from

Conversation

sweep-ai[bot]
Copy link

@sweep-ai sweep-ai bot commented Oct 12, 2023

PR Feedback (click)

  • 👍 Sweep Did Well
  • 👎 Sweep Needs Improvement

Description

This PR refactors the logger system in the Ubiquity GitHub Bot project to be event-based, making it easier to use and accessible on the runtime.logger object.

Summary of Changes

  • Refactored the getLogger function in src/bindings.ts to return an event-based logger that emits events whenever a log message is generated.
  • Added a method to the logger to allow other modules to subscribe to its events.
  • Updated the logger's methods to emit events instead of directly logging the messages.
  • Created src/events/loggerEvents.ts to define a set of events that the logger can emit.
  • Imported the logger events in src/handlers/shared/handler.ts and updated the usage of the logger in the nullHandler function to subscribe to the DEBUG event and handle the event by logging the message.

Please review and merge this PR to incorporate the event-based logger system into the project.

Fixes #12.


🎉 Latest improvements to Sweep:

  • Sweep can now passively improve your repository! Check out Rules to learn more.

💡 To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

@sweep-ai
Copy link
Author

sweep-ai bot commented Oct 12, 2023

Rollback Files For Sweep

  • Rollback changes to src/bindings.ts
  • Rollback changes to src/events/loggerEvents.ts

@sweep-ai
Copy link
Author

sweep-ai bot commented Oct 12, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.

@sweep-ai sweep-ai bot added the sweep label Oct 12, 2023
@sweep-ai sweep-ai bot mentioned this pull request Oct 12, 2023
3 tasks
@sweep-ai
Copy link
Author

sweep-ai bot commented Oct 12, 2023

Created PR: #14 to fix All new business logic should have corresponding unit tests in the tests/ directory..
This PR was made against the sweep/refactor-logger branch, not your main branch, so it's safe to merge if it looks good!

@0x4007 0x4007 closed this Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: refactor logger
1 participant