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

access log level in hook #909 #944

Merged
merged 2 commits into from
Dec 31, 2020
Merged

Conversation

DoranYun
Copy link
Contributor

For #909

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

Good work! Can you please add a unit test?

@DoranYun
Copy link
Contributor Author

Good work! Can you please add a unit test?

ok.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -31,7 +31,7 @@ function genLog (level, hook) {
if (!hook) return LOG

return function hookWrappedLog (...args) {
hook.call(this, args, LOG)
hook.call(this, args, LOG, level)
Copy link
Member

Choose a reason for hiding this comment

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

@mcollina this will retain a reference to the closure where level is defined. Do you foresee any optimization issues with this? Should the function be defined and a property attached to it so it can be hook.call(this, args, LOG, this.level)?

Copy link
Member

Choose a reason for hiding this comment

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

This is ok for me, the closure context will be kept anyway.

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link

github-actions bot commented Feb 2, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants