mirror of
https://gitee.com/yansongda/pay.git
synced 2024-12-04 21:29:29 +08:00
update
This commit is contained in:
parent
0f55bf6618
commit
b93e9942d2
@ -24,14 +24,10 @@ class EventServiceProvider implements ServiceProviderInterface
|
||||
*/
|
||||
public function register(Pay $pay): void
|
||||
{
|
||||
$service = function () use ($pay) {
|
||||
$event = $pay::make(EventDispatcher::class);
|
||||
$event = $pay::make(EventDispatcher::class);
|
||||
|
||||
$event->addSubscriber(new KernelLogSubscriber());
|
||||
$event->addSubscriber(new KernelLogSubscriber());
|
||||
|
||||
return $event;
|
||||
};
|
||||
|
||||
$pay::set(EventDispatcherInterface::class, $service);
|
||||
$pay::set(EventDispatcherInterface::class, $event);
|
||||
}
|
||||
}
|
||||
|
@ -28,43 +28,39 @@ class LoggerServiceProvider implements ServiceProviderInterface
|
||||
/* @var ConfigInterface $config */
|
||||
$config = Pay::get(ConfigInterface::class);
|
||||
|
||||
$service = function () use ($config) {
|
||||
$logger = new class($config) extends Logger {
|
||||
/**
|
||||
* @var ConfigInterface
|
||||
*/
|
||||
private $conf;
|
||||
$logger = new class($config) extends Logger {
|
||||
/**
|
||||
* @var ConfigInterface
|
||||
*/
|
||||
private $conf;
|
||||
|
||||
/**
|
||||
* Bootstrap.
|
||||
*/
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
$this->conf = $config;
|
||||
/**
|
||||
* Bootstrap.
|
||||
*/
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
$this->conf = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* __call.
|
||||
*
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __call(string $method, array $args): void
|
||||
{
|
||||
if (false === $this->conf->get('log.enable', true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* __call.
|
||||
*
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __call(string $method, array $args): void
|
||||
{
|
||||
if (false === $this->conf->get('log.enable', true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::__call($method, $args);
|
||||
}
|
||||
};
|
||||
|
||||
$logger->setConfig($config->get('log'));
|
||||
|
||||
return $logger;
|
||||
parent::__call($method, $args);
|
||||
}
|
||||
};
|
||||
|
||||
$pay::set(LoggerInterface::class, $service);
|
||||
$logger->setConfig($config->get('log'));
|
||||
|
||||
$pay::set(LoggerInterface::class, $logger);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user