-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.php
39 lines (32 loc) · 1.19 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php declare( strict_types=1 );
use lloc\Nowpayments\AdminWidget;
use lloc\Nowpayments\Logs\StructuredLogsFormatter;
use lloc\Nowpayments\Rest\Api;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Psr\Log\LogLevel;
use Psr\Log\LoggerInterface;
use Psr\Container\ContainerInterface;
use function DI\create;
use function DI\get;
use function DI\factory;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
return array(
'formatter' => create( StructuredLogsFormatter::class ),
'debug_handler' => create( StreamHandler::class )
->constructor( 'php://stdout', LogLevel::DEBUG )
->method( 'setFormatter', get( 'formatter' ) ),
'error_handler' => create( StreamHandler::class )
->constructor( 'php://stderr', LogLevel::ERROR )
->method( 'setFormatter', get( 'formatter' ) ),
LoggerInterface::class => function ( ContainerInterface $c ) {
$logger = new Logger( 'wp-nowpayments-integration-logs' );
$logger->pushHandler( $c->get( 'debug_handler' ) );
$logger->pushHandler( $c->get( 'error_handler' ) );
return $logger;
},
Api::class => factory( array( Api::class, 'create' ) ),
AdminWidget::class => factory( array( AdminWidget::class, 'create' ) ),
);