woocommerce-paypal-payments/modules.local/woocommerce-logging/services.php
2020-07-01 13:38:15 +03:00

30 lines
872 B
PHP

<?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;
use Psr\Log\LoggerInterface;
return [
'woocommerce.logger.source' => function(): string {
return 'woocommerce-paypal-commerce-gateway';
},
'woocommerce.logger.woocommerce' => function (ContainerInterface $container): LoggerInterface {
if (!class_exists(\WC_Logger::class)) {
return new NullLogger();
}
$source = $container->get('woocommerce.logger.source');
return new WooCommerceLogger(
wc_get_logger(),
$source
);
},
];