-
Notifications
You must be signed in to change notification settings - Fork 110
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
Expose the logging functions to client-side extensions and automatically account for the value of isDebug
#1895
Expose the logging functions to client-side extensions and automatically account for the value of isDebug
#1895
Conversation
…lly account for the value of isDebug Signed-off-by: Shyamsundar Gadde <[email protected]>
error( ...message ) { | ||
// eslint-disable-next-line no-console | ||
console.error( this.prefix, ...message ); | ||
}, |
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.
Note about error logging: I noticed that in 5 out of 7 usages, the error function was called without checking isDebug
first. It seemed intentional that errors should always be shown, so I've maintained this behavior in the logger implementation. The remaining two cases still explicitly check isDebug
before calling error()
. Let me know if we should standardize this behavior differently.
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.
Yeah, good call. This probably makes sense to log out even if not isDebug
.
Co-authored-by: Weston Ruter <[email protected]>
Co-authored-by: Weston Ruter <[email protected]>
Signed-off-by: Shyamsundar Gadde <[email protected]>
Signed-off-by: Shyamsundar Gadde <[email protected]>
Signed-off-by: Shyamsundar Gadde <[email protected]>
Signed-off-by: Shyamsundar Gadde <[email protected]>
Signed-off-by: Shyamsundar Gadde <[email protected]>
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Co-authored-by: Weston Ruter <[email protected]>
Signed-off-by: Shyamsundar Gadde <[email protected]>
Signed-off-by: Shyamsundar Gadde <[email protected]>
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.
Summary
Fixes #1886
Relevant technical choices
logger
object that encapsulateslog
,info
,warn
, anderror
methods.isDebug
coming fromWP_DEBUG
in PHP.initialize()
andfinalize()
functions.error()
) always log regardless ofisDebug
, since most existing calls didn't check for it.