wc_get_logger refactored
This commit is contained in:
parent
2bb466d53f
commit
76a9e19471
|
@ -1636,15 +1636,14 @@ function wc_get_logger() {
|
|||
|
||||
$class = apply_filters( 'woocommerce_logging_class', 'WC_Logger' );
|
||||
|
||||
if ( null === $logger || ! is_a( $logger, $class ) ) {
|
||||
if ( null !== $logger && is_a( $logger, $class ) ) {
|
||||
return $logger;
|
||||
}
|
||||
|
||||
$implements = class_implements( $class );
|
||||
|
||||
if ( is_array( $implements ) && in_array( 'WC_Logger_Interface', $implements, true ) ) {
|
||||
if ( is_object( $class ) ) {
|
||||
$logger = $class;
|
||||
} else {
|
||||
$logger = new $class();
|
||||
}
|
||||
$logger = is_object( $class ) ? $class : new $class();
|
||||
} else {
|
||||
wc_doing_it_wrong(
|
||||
__FUNCTION__,
|
||||
|
@ -1657,9 +1656,10 @@ function wc_get_logger() {
|
|||
),
|
||||
'3.0'
|
||||
);
|
||||
|
||||
$logger = is_a( $logger, 'WC_Logger' ) ? $logger : new WC_Logger();
|
||||
}
|
||||
}
|
||||
|
||||
return $logger;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue