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 <shyamsundar.gadde@rtcamp.com>
| error( ...message ) { | ||
| // eslint-disable-next-line no-console | ||
| console.error( this.prefix, ...message ); | ||
| }, |
There was a problem hiding this comment.
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.
Yeah, good call. This probably makes sense to log out even if not isDebug.
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
|
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 <westonruter@google.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>
Signed-off-by: Shyamsundar Gadde <shyamsundar.gadde@rtcamp.com>


Summary
Fixes #1886
Relevant technical choices
loggerobject that encapsulateslog,info,warn, anderrormethods.isDebugcoming fromWP_DEBUGin PHP.initialize()andfinalize()functions.error()) always log regardless ofisDebug, since most existing calls didn't check for it.