2020-08-27 12:31:16 +03:00
|
|
|
<?php
|
2020-07-01 13:03:21 +03:00
|
|
|
/**
|
2020-08-27 12:31:16 +03:00
|
|
|
* The logging services.
|
|
|
|
*
|
2020-09-11 14:11:10 +03:00
|
|
|
* @package WooCommerce\WooCommerce\Logging
|
2020-07-01 13:03:21 +03:00
|
|
|
*/
|
|
|
|
|
2020-08-27 12:31:16 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-09-11 14:11:10 +03:00
|
|
|
namespace WooCommerce\WooCommerce\Logging;
|
2020-07-01 13:03:21 +03:00
|
|
|
|
2020-09-11 14:11:10 +03:00
|
|
|
use WooCommerce\WooCommerce\Logging\Logger\NullLogger;
|
|
|
|
use WooCommerce\WooCommerce\Logging\Logger\WooCommerceLogger;
|
2022-11-09 10:11:31 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
2020-07-01 13:38:15 +03:00
|
|
|
use Psr\Log\LoggerInterface;
|
2020-07-01 13:03:21 +03:00
|
|
|
|
2020-08-27 12:31:16 +03:00
|
|
|
return array(
|
|
|
|
'woocommerce.logger.source' => function(): string {
|
2020-10-08 20:03:07 -03:00
|
|
|
return 'woocommerce-paypal-payments';
|
2020-08-27 12:31:16 +03:00
|
|
|
},
|
|
|
|
'woocommerce.logger.woocommerce' => function ( ContainerInterface $container ): LoggerInterface {
|
|
|
|
if ( ! class_exists( \WC_Logger::class ) ) {
|
|
|
|
return new NullLogger();
|
|
|
|
}
|
2020-07-01 13:03:21 +03:00
|
|
|
|
2020-08-27 12:31:16 +03:00
|
|
|
$source = $container->get( 'woocommerce.logger.source' );
|
2020-07-01 13:38:15 +03:00
|
|
|
|
2020-08-27 12:31:16 +03:00
|
|
|
return new WooCommerceLogger(
|
|
|
|
wc_get_logger(),
|
|
|
|
$source
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|