Skip to content

Feature/debug function - #907

Merged
dr-dimitru merged 6 commits into
release/3.1.0from
feature/debug-function
Oct 1, 2026
Merged

dr-dimitru merged 6 commits into
release/3.1.0from
feature/debug-function

Conversation

@jankapunkt

Copy link
Copy Markdown
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

@jankapunkt

Copy link
Copy Markdown
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?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread server.js Outdated
Comment thread client.js Outdated
Comment thread docs/constructor.md Outdated
jankapunkt and others added 2 commits November 25, 2025 13:05
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@dr-dimitru dr-dimitru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@dr-dimitru
dr-dimitru changed the base branch from dev to release/3.1.0 October 1, 2026 16:12
@dr-dimitru
dr-dimitru merged commit b3930ea into release/3.1.0 Oct 1, 2026
4 checks passed
@dr-dimitru dr-dimitru mentioned this pull request Oct 1, 2026
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