2020-07-01 13:03:21 +03:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
/**
|
|
|
|
* phpcs:disable Inpsyde.CodeQuality.ReturnTypeDeclaration
|
|
|
|
* phpcs:disable Inpsyde.CodeQuality.ArgumentTypeDeclaration
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Inpsyde\Woocommerce\Logging;
|
|
|
|
|
|
|
|
use Inpsyde\Woocommerce\Logging\Logger\NullLogger;
|
|
|
|
use Inpsyde\Woocommerce\Logging\Logger\WooCommerceLogger;
|
|
|
|
use Psr\Container\ContainerInterface;
|
2020-07-01 13:38:15 +03:00
|
|
|
use Psr\Log\LoggerInterface;
|
2020-07-01 13:03:21 +03:00
|
|
|
|
|
|
|
return [
|
2020-07-01 13:38:15 +03:00
|
|
|
'woocommerce.logger.source' => function(): string {
|
|
|
|
return 'woocommerce-paypal-commerce-gateway';
|
|
|
|
},
|
|
|
|
'woocommerce.logger.woocommerce' => function (ContainerInterface $container): LoggerInterface {
|
2020-07-01 13:03:21 +03:00
|
|
|
if (!class_exists(\WC_Logger::class)) {
|
|
|
|
return new NullLogger();
|
|
|
|
}
|
|
|
|
|
2020-07-01 13:38:15 +03:00
|
|
|
$source = $container->get('woocommerce.logger.source');
|
|
|
|
|
2020-07-01 13:03:21 +03:00
|
|
|
return new WooCommerceLogger(
|
2020-07-01 13:38:15 +03:00
|
|
|
wc_get_logger(),
|
|
|
|
$source
|
2020-07-01 13:03:21 +03:00
|
|
|
);
|
|
|
|
},
|
|
|
|
];
|