本文整理匯總了PHP中Psr\Log\LoggerInterface::popHandler方法的典型用法代碼示例。如果您正苦於以下問題:PHP LoggerInterface::popHandler方法的具體用法?PHP LoggerInterface::popHandler怎麽用?PHP LoggerInterface::popHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Psr\Log\LoggerInterface
的用法示例。
在下文中一共展示了LoggerInterface::popHandler方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$file = $input->getArgument('file');
if (!is_file($file)) {
throw new RuntimeException('File does not exists');
}
$verbose = $output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL;
if (!$verbose) {
$this->logger->pushHandler(new NullHandler());
}
try {
$this->connection->beginTransaction();
$result = $this->importService->import(file_get_contents($file));
$this->connection->commit();
$output->writeln('Import successful!');
$output->writeln('The following actions were done:');
$output->writeln('');
foreach ($result as $message) {
$output->writeln('- ' . $message);
}
} catch (\Exception $e) {
$this->connection->rollback();
$output->writeln('An exception occured during import. No changes are applied to the database.');
$output->writeln('');
$output->writeln('Message: ' . $e->getMessage());
$output->writeln('Trace: ' . $e->getTraceAsString());
}
if (!$verbose) {
$this->logger->popHandler();
}
}
示例2: debugFilePath
/**
* Set different debug file location.
*
* @access public
* @param string $path File path
* @return \carteiro\Mail
*/
public function debugFilePath($path)
{
$this->debug(true);
$this->logger->popHandler();
$this->logger->pushHandler(new StreamHandler($path, Logger::DEBUG));
return $this;
}
示例3: request
/**
* @param string $method
* @param string $path
* @param array|null $body
* @return mixed
*/
public function request($method, $path, $body = null, $verbose = false)
{
$header = ['User-Agent' => 'Fusio-System v' . Base::getVersion(), 'Authorization' => 'Bearer ' . $this->getAccessToken()];
$body = $body !== null ? Parser::encode($body) : null;
$request = new Request(new Url('http://127.0.0.1/backend/' . $path), $method, $header, $body);
$response = new Response();
$response->setBody(new TempStream(fopen('php://memory', 'r+')));
$this->logger->pushHandler($verbose ? new StreamHandler(STDOUT) : new NullHandler());
$this->dispatch->route($request, $response, null, false);
$this->logger->popHandler();
$body = (string) $response->getBody();
$data = Parser::decode($body, false);
return $data;
}