Skip to content
Snippets Groups Projects

feat/message handling

Merged Bartek Jaskulski requested to merge feat/message-handling into master
1 file
+ 7
3
Compare changes
  • Side-by-side
  • Inline
+ 7
3
@@ -44,9 +44,13 @@ final class SimpleLoggerFactory implements LoggerFactory {
\add_action( 'woocommerce_init', [ $this, 'create_wc_handler' ] );
}
// Adding WooCommerce logger may have failed, if so add WP by default.
if ( empty( $this->logger->getHandlers() ) ) {
$this->logger->pushHandler( $this->get_wp_handler() );
// In the worst-case scenario, when WC logs are not available (yet, or at all),
// fallback to WP logs, but only when enabled.
if ( empty( $this->logger->getHandlers() ) && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
$this->set_handler(
$this->logger,
new ErrorLogHandler( ErrorLogHandler::OPERATING_SYSTEM, $this->options['level'] );
);
}
return $this->logger;
Loading