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

Fix logifyAsync, logifySync decorators. #372

Merged
merged 1 commit into from
Oct 20, 2016
Merged

Fix logifyAsync, logifySync decorators. #372

merged 1 commit into from
Oct 20, 2016

Conversation

seansfkelley
Copy link
Contributor

@seansfkelley seansfkelley commented Oct 11, 2016

The decorator spec requires that a function decorator either:

  • returns a new /descriptor/ for the property, or
  • changes the fields on the given descriptor

The logify* methods instead returned a new function implementation, which
is not correct, and caused the decorations to be silently ignored.

decorator spec: https://github.com/wycats/javascript-decorators#detailed-design
function decorator example: https://github.com/jayphelps/core-decorators.js/blob/master/src/deprecate.js

This commit changes logifySync and logifyAsync in the following ways:

  • they now have no return value, and instead modify the descriptor
  • they now must be called with no arguments so they can properly capture
    the this value (without this, the function cannot find the logger instance)
  • they now log at 'verbose', because they are extremely verbose
  • remove 'error' flag from non-error logging
  • they truncate their serialized arguments to (arbitrarily) 100 characters because
    otherwise they they OOM the node process

Additionally, one async method was erroneously decorated with logifySync.

The decorator spec requires that a function decorator either:

- returns a new /descriptor/ for the property, or
- changes the fields on the given descriptor

The logify* methods instead returned a new function implementation, which
is not correct, and caused the decorations to be silently ignored.

decorator spec: https://github.com/wycats/javascript-decorators#detailed-design
function decorator example: https://github.com/jayphelps/core-decorators.js/blob/master/src/deprecate.js

This commit changes logifySync and logifyAsync in the following ways:

- they now have no return value, and instead modify the descriptor
- they now must be called with no arguments so they can properly capture
  the `this` value (without this, the function cannot find the logger instance)
- they now log at 'verbose', because they are extremely verbose
- remove 'error' flag from non-error logging
- they truncate their serialized arguments to (arbitrarily) 100 characters because
  otherwise they they OOM the node process

Additionally, one async method was erroneously decorated with logifySync.
@seansfkelley
Copy link
Contributor Author

AppVeyor's 0.10 build failed with permissions issues, per usual...

@seansfkelley
Copy link
Contributor Author

seansfkelley commented Oct 17, 2016

Hey @hzoo / @thejameskyle, this is a pretty bad bug to leave lying around. Can this (and hopefully #373 too) get merged sooner rather than later?

@jamiebuilds jamiebuilds merged commit cc9b487 into lerna:master Oct 20, 2016
@seansfkelley seansfkelley deleted the fix-logify branch October 20, 2016 18:53
@seansfkelley
Copy link
Contributor Author

Thank you!

douglasduteil pushed a commit to douglasduteil/lerna that referenced this pull request Oct 20, 2016
The decorator spec requires that a function decorator either:

- returns a new /descriptor/ for the property, or
- changes the fields on the given descriptor

The logify* methods instead returned a new function implementation, which
is not correct, and caused the decorations to be silently ignored.

decorator spec: https://github.com/wycats/javascript-decorators#detailed-design
function decorator example: https://github.com/jayphelps/core-decorators.js/blob/master/src/deprecate.js

This commit changes logifySync and logifyAsync in the following ways:

- they now have no return value, and instead modify the descriptor
- they now must be called with no arguments so they can properly capture
  the `this` value (without this, the function cannot find the logger instance)
- they now log at 'verbose', because they are extremely verbose
- remove 'error' flag from non-error logging
- they truncate their serialized arguments to (arbitrarily) 100 characters because
  otherwise they they OOM the node process

Additionally, one async method was erroneously decorated with logifySync.
@gigabo gigabo added the bug label Dec 14, 2016
@lock
Copy link

lock bot commented Dec 27, 2018

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

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
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