From 27125ff668e1dc14165243803e8f2cfbabe83226 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola <grzegorz.rola@octolize.com> Date: Tue, 26 Mar 2024 13:05:32 +0000 Subject: [PATCH] bugfix(wc logger): initialisation --- CHANGELOG.md | 6 +++++- src/SimpleLoggerFactory.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a295bc3..b0fcfb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## [1.12.0] - 2023-07-10 +## [1.12.1] - 2024-03-26 +### Fixed +- WC logger initialisation + +## [1.12.0] - 2024-03-19 ### Added - sensitive data replacer diff --git a/src/SimpleLoggerFactory.php b/src/SimpleLoggerFactory.php index cf88a94..432be72 100644 --- a/src/SimpleLoggerFactory.php +++ b/src/SimpleLoggerFactory.php @@ -33,7 +33,7 @@ final class SimpleLoggerFactory implements LoggerFactory { $this->logger = new Logger( $this->channel ); if ( $this->options->use_wc_log ) { - if ( \function_exists( 'wc_get_logger' ) ) { + if ( \function_exists( 'wc_get_logger' ) && \did_action( 'woocommerce_init' ) ) { $this->create_wc_handler(); } else { \add_action( 'woocommerce_init', [ $this, 'create_wc_handler' ] ); -- GitLab