Return new logger instance if class changes.

This commit is contained in:
Mike Jolley 2018-03-01 16:24:53 +00:00
parent 21d7dbc612
commit 3d4b1e6d4c
1 changed files with 6 additions and 5 deletions

View File

@ -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;