Add custom logger support#17
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds custom logger support to Cronbake, allowing users to inject their own logger implementations instead of relying on the default console object. This is useful for applications that use structured logging or want to integrate with specific logging frameworks.
- Introduced a
Loggerinterface with standard logging methods (info, error, warn, debug) - Added optional
loggerparameter to bothBakerandCronclasses with fallback toconsole - Replaced all hardcoded
console.warnandconsole.logcalls with the configurable logger - Added comprehensive tests to verify logger injection and override behavior
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/types.ts | Defines the Logger interface and adds logger property to CronOptions and IBakerOptions |
| lib/utils.ts | Updates CBResolver to accept and use a logger parameter instead of hardcoded console |
| lib/cron.ts | Adds logger initialization and passes it to CBResolver bindings, replaces console.warn calls |
| lib/baker.ts | Implements logger initialization, propagation to child cron jobs, and replaces all console calls |
| lib/logger.test.ts | Adds test cases for custom logger functionality in Baker and Cron |
| README.md | Documents the custom logger feature with an example using LogTape |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…other copilot suggestions
Owner
|
Thank you @nemvince for the awesome PR. Everything looks good and the custom logger support is a nice addition. Appreciate the thorough tests too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, hope this PR is welcome, I added in support for custom loggers. Let me know if anything I added doesn't align with your views or if you want anything changed.
All the best!