Return new logger instance if class changes.
This commit is contained in:
parent
21d7dbc612
commit
3d4b1e6d4c
|
@ -4,8 +4,6 @@
|
|||
*
|
||||
* General core functions available on both the front-end and admin.
|
||||
*
|
||||
* @author Automattic
|
||||
* @category Core
|
||||
* @package WooCommerce\Functions
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
@ -1625,9 +1623,12 @@ function wc_remove_number_precision_deep( $value ) {
|
|||
*/
|
||||
function wc_get_logger() {
|
||||
static $logger = null;
|
||||
if ( null === $logger ) {
|
||||
$class = apply_filters( 'woocommerce_logging_class', 'WC_Logger' );
|
||||
|
||||
$class = apply_filters( 'woocommerce_logging_class', 'WC_Logger' );
|
||||
|
||||
if ( null === $logger || ! is_a( $logger, $class ) ) {
|
||||
$implements = class_implements( $class );
|
||||
|
||||
if ( is_array( $implements ) && in_array( 'WC_Logger_Interface', $implements ) ) {
|
||||
if ( is_object( $class ) ) {
|
||||
$logger = $class;
|
||||
|
@ -1646,7 +1647,7 @@ function wc_get_logger() {
|
|||
),
|
||||
'3.0'
|
||||
);
|
||||
$logger = new WC_Logger();
|
||||
$logger = is_a( $logger, 'WC_Logger' ) ? $logger : new WC_Logger();
|
||||
}
|
||||
}
|
||||
return $logger;
|
||||
|
|
Loading…
Reference in New Issue