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
|
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, $event);
|
||||||
};
|
|
||||||
|
|
||||||
$pay::set(EventDispatcherInterface::class, $service);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,43 +28,39 @@ class LoggerServiceProvider implements ServiceProviderInterface
|
|||||||
/* @var ConfigInterface $config */
|
/* @var ConfigInterface $config */
|
||||||
$config = Pay::get(ConfigInterface::class);
|
$config = Pay::get(ConfigInterface::class);
|
||||||
|
|
||||||
$service = function () use ($config) {
|
$logger = new class($config) extends Logger {
|
||||||
$logger = new class($config) extends Logger {
|
/**
|
||||||
/**
|
* @var ConfigInterface
|
||||||
* @var ConfigInterface
|
*/
|
||||||
*/
|
private $conf;
|
||||||
private $conf;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap.
|
* Bootstrap.
|
||||||
*/
|
*/
|
||||||
public function __construct(Config $config)
|
public function __construct(Config $config)
|
||||||
{
|
{
|
||||||
$this->conf = $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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
parent::__call($method, $args);
|
||||||
* __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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$pay::set(LoggerInterface::class, $service);
|
$logger->setConfig($config->get('log'));
|
||||||
|
|
||||||
|
$pay::set(LoggerInterface::class, $logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user