Skip to content

Add custom logger support#17

Merged
chaqchase merged 3 commits into
chaqchase:mainfrom
nemvince:custom-logger-support
Dec 8, 2025
Merged

Add custom logger support#17
chaqchase merged 3 commits into
chaqchase:mainfrom
nemvince:custom-logger-support

Conversation

@nemvince
Copy link
Copy Markdown
Contributor

@nemvince nemvince commented Dec 7, 2025

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!

Copilot AI review requested due to automatic review settings December 7, 2025 20:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Logger interface with standard logging methods (info, error, warn, debug)
  • Added optional logger parameter to both Baker and Cron classes with fallback to console
  • Replaced all hardcoded console.warn and console.log calls 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.

Comment thread lib/logger.test.ts
Comment thread lib/logger.test.ts
Comment thread README.md Outdated
Comment thread lib/logger.test.ts Outdated
Comment thread lib/logger.test.ts
Comment thread lib/logger.test.ts Outdated
@chaqchase
Copy link
Copy Markdown
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.

@chaqchase chaqchase merged commit 6608734 into chaqchase:main Dec 8, 2025
1 check passed
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.

3 participants