mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add filter for enabling logging
This commit is contained in:
parent
6ee900cb01
commit
be55fcf711
2 changed files with 13 additions and 2 deletions
|
@ -88,8 +88,7 @@ return array(
|
|||
);
|
||||
},
|
||||
'woocommerce.logger.woocommerce' => function ( ContainerInterface $container ): LoggerInterface {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
if ( ! function_exists( 'wc_get_logger' ) || ! $settings->has( 'logging_enabled' ) || ! $settings->get( 'logging_enabled' ) ) {
|
||||
if ( ! function_exists( 'wc_get_logger' ) || ! $container->get( 'wcgateway.logging.is-enabled' ) ) {
|
||||
return new NullLogger();
|
||||
}
|
||||
|
||||
|
|
|
@ -2129,4 +2129,16 @@ return array(
|
|||
$container->get( 'wcgateway.settings' )
|
||||
);
|
||||
},
|
||||
|
||||
'wcgateway.logging.is-enabled' => function ( ContainerInterface $container ) : bool {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
|
||||
/**
|
||||
* Whether the logging of the plugin errors/events is enabled.
|
||||
*/
|
||||
return apply_filters(
|
||||
'woocommerce_paypal_payments_is_logging_enabled',
|
||||
$settings->has( 'logging_enabled' ) && $settings->get( 'logging_enabled' )
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue