You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should also probably wrap error logging within checks for if ( WP_DEBUG ) like WordPress core does, as well. 🤷
^ No, because I don't want to require this to help debug something for someone.
The text was updated successfully, but these errors were encountered:
Better yet, all logging should be handled custom and visible in an admin screen for the plugin! Logging to the server doesn't help with support requests where I simply gain access to their WordPress admin. (And I definitely don't want SSH access to their server, anyways!)
MichelleBlanchette
changed the title
Prefer trigger_error() over error_log()
Improve logging and log visibility
Nov 10, 2023
Log file should be in wp-content/uploads folder so it doesn't get deleted every time the plugin files are updated (also, see about WordPress VIP's filesystem restrictions which permit that folder only)
Download button should be made available in wp-admin to download the log file so it can be provided to technical support (we should never have a reason to log into a user's system)
Log function can probably mimic trigger_error()'s verbosity by getting the prior stacktrace function automatically (we shouldn't need to manually pass __FUNCTION__ every time like wp_trigger_error() expects... 🙄
Setting to enable or disable logging, default to disabled since users should only need logging to debug issues (like us in active development)
Uh oh!
There was an error while loading. Please reload this page.
Refer to WordPress's usage in the source code of this function: https://developer.wordpress.org/reference/functions/_deprecated_function/
The
trigger_error()
function has all the verbosity I've been wanting, such as the file and line number where called.Applicable constants are here: https://www.php.net/manual/en/errorfunc.constants.php
Should also probably wrap error logging within checks for🤷if ( WP_DEBUG )
like WordPress core does, as well.^ No, because I don't want to require this to help debug something for someone.
The text was updated successfully, but these errors were encountered: