diff --git a/includes/class-wc-logger.php b/includes/class-wc-logger.php index 040dd580529..ef2184f43f1 100644 --- a/includes/class-wc-logger.php +++ b/includes/class-wc-logger.php @@ -139,11 +139,14 @@ class WC_Logger implements WC_Logger_Interface { } if ( $this->should_handle( $level ) ) { - $timestamp = current_time( 'timestamp', 1 ); - $message = apply_filters( 'woocommerce_logger_log_message', $message, $level, $context ); + $timestamp = time(); foreach ( $this->handlers as $handler ) { - $handler->handle( $timestamp, $level, $message, $context ); + $message = apply_filters( 'woocommerce_logger_log_message', $message, $level, $context, $handler ); + + if ( null !== $message ) { + $handler->handle( $timestamp, $level, $message, $context ); + } } } }