Skip to content

Conversation

@jankapunkt
Copy link
Collaborator

Implements #906 by allowing debug to be a boolean or function type.

  • if boolean is passed, logging is either off or done to console (non-breaking default)
  • if a function is passed, logging is done into this function
  • function arguments are ...args as in the original logging

dr-dimitru and others added 4 commits September 24, 2025 12:09
v3.0.0 is finally out! Fully refactored version of Meteor files, now with tests, async support, latest Meteor, release support, and with many improved and fixed features. See v3.0.0 release notes and v3 migration document for more details.

Special thanks to: @bratelefant @harryadel @jankapunkt @StorytellerCZ @make-github-pseudonymous-again
- 🔧 Fix FileObject data in upload events via `http` transport
- 📔 Harden documentation
@jankapunkt
Copy link
Collaborator Author

@dr-dimitru I think there should be one or two additional tests to make sure this is not breaking. What do you think?

Copy link

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 implements feature request #906 by extending the debug configuration parameter to accept either a boolean or a function type. When a function is provided, all debug logging is routed to that custom function instead of the console, allowing developers to integrate with their own logging systems.

Key Changes

  • Modified _debug() method in core.js to check if debug is a function and use it accordingly
  • Updated validation logic in server.js and client.js to accept both boolean and function types
  • Updated JSDoc comments and documentation to reflect the new function parameter option

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
core.js Modified _debug() method to conditionally use custom debug function when provided, falling back to console logging when debug === true
server.js Updated validation to accept function type for debug parameter and updated JSDoc documentation
client.js Updated validation to accept function type for debug parameter and updated JSDoc documentation
docs/constructor.md Updated documentation table to reflect that debug accepts Boolean or Function type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@dr-dimitru dr-dimitru left a comment

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow option to pass a function for debug parameter

3 participants