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

Improve errors in logs #550

Open
bwmarkle opened this issue Mar 22, 2023 · 0 comments
Open

Improve errors in logs #550

bwmarkle opened this issue Mar 22, 2023 · 0 comments

Comments

@bwmarkle
Copy link
Contributor

  1. Include a "friendly notice" that says this is the last error found by php, but it doesn't necessarily mean it was triggered by the backup plugin, or that the backup failed
  2. We should add descriptions for the error numbers so it's easier to see it was a fatal or just a warning

/**
* Add the last error to the log.
*
* The error is only added to the log if it hasn't been logged before.
*
* @since 1.13.5
*/
public function add_last_error() {
$current_error = error_get_last();
// Only new errors are logged.
if ( $current_error !== $this->last_error ) {
$this->add( 'Last error: ' . print_r( $current_error, 1 ), false ); // phpcs:ignore
}
// This method will be called often, so keep track of errors to avoid logging duplicates.
$this->last_error = $current_error;
}

Maybe add "type description" below.

[2023-03-21 09:51:23 UTC] Last error: Array
(
[type] => 8
[type_description] => 'E_NOTICE (int) - Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.',
[message] => mysqli_query(): send of 4852 bytes failed with errno=104 Connection reset by peer
[file] => /home/user/public_html/wp-includes/class-wpdb.php
[line] => 2187
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant