Skip to content

Commit

Permalink
Add a filter to modify error message in logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
vedanshujain committed Jul 13, 2022
1 parent 1aa33bd commit efb29e5
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -232,7 +232,7 @@ private function get_processor_instance( string $processor_class_name ) : BatchP
/**
* Filters the instance of processor for current class name.
*
* @since 6.7.0.
* @since 6.8.0.
*/
$processor = apply_filters( 'woocommerce_get_batch_processor', $processor, $processor_class_name );
if ( ! isset( $processor ) && class_exists( $processor_class_name ) ) {
Expand Down Expand Up @@ -317,6 +317,12 @@ protected function log_error( \Exception $error, BatchProcessorInterface $batch_
);
}
$error_message = "Error processing batch for {$batch_processor->get_name()}: {$error->getMessage()}" . $batch_detail_string;
/**
* Filters the error message for a batch processor.
*
* @since 6.8.0
*/
$error_message = apply_filters( 'wc_batch_processing_log_message', $error_message, $error, $batch_processor, $batch );
$this->logger->error( $error_message, array( 'exception' => $error ) );
}

Expand Down

0 comments on commit efb29e5

Please sign in to comment.