-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
module: remove unnecessary JSON.stringify #3578
Conversation
could template strings have a similar result? |
LGTM. It's simpler to read too. I think template strings would suffer the same problem as the original code (stringification even when not debugging). |
For the |
debug('RELATIVE: requested:' + request + | ||
' set ID to: ' + id + ' from ' + parent.id); | ||
debug('RELATIVE: requested: %s set ID to: %s from %s', request, id, | ||
parent.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style nit: this should align with the previous line's parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
`debuglog` uses `%j` as a placeholder for replacement with `JSON.stringify`. So that `JSON.stringify` is only called when the appropriate debug flag is on. The other `%s` changes are for style consistency.
LGTM with a style nit |
LGTM |
LGTM but since this touches module we may want more @nodejs/ctc review. |
I generally hate how we handle |
Seems like everyone is Ok on this. Merge? |
@jasnell am I good to land this or do we want to get CTC review? |
I think 3 CTC LGTMs and 2 more from collaborators should be sufficient. |
Although, has CI been run? |
Good catch. CI: https://ci.nodejs.org/job/node-test-pull-request/674/ |
+1 :)
|
`debuglog` uses `%j` as a placeholder for replacement with `JSON.stringify`. So that `JSON.stringify` is only called when the appropriate debug flag is on. The other `%s` changes are for style consistency. PR-URL: #3578 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
CI was green. Landed in faa3bb8 |
`debuglog` uses `%j` as a placeholder for replacement with `JSON.stringify`. So that `JSON.stringify` is only called when the appropriate debug flag is on. The other `%s` changes are for style consistency. PR-URL: #3578 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
`debuglog` uses `%j` as a placeholder for replacement with `JSON.stringify`. So that `JSON.stringify` is only called when the appropriate debug flag is on. The other `%s` changes are for style consistency. PR-URL: #3578 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
landed in lts-v4.x-staging as 948af71 |
`debuglog` uses `%j` as a placeholder for replacement with `JSON.stringify`. So that `JSON.stringify` is only called when the appropriate debug flag is on. The other `%s` changes are for style consistency. PR-URL: #3578 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
`debuglog` uses `%j` as a placeholder for replacement with `JSON.stringify`. So that `JSON.stringify` is only called when the appropriate debug flag is on. The other `%s` changes are for style consistency. PR-URL: #3578 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
`debuglog` uses `%j` as a placeholder for replacement with `JSON.stringify`. So that `JSON.stringify` is only called when the appropriate debug flag is on. The other `%s` changes are for style consistency. PR-URL: #3578 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Use
debulog
's placeholder replacement%j
for stringification. So calls toJSON.stringify
are only made bydebuglog
when you're actually debugging. Also, made the remaining calls todebuglog
consistent with this style.