本文整理匯總了PHP中Psr\Log\LoggerInterface::addDebug方法的典型用法代碼示例。如果您正苦於以下問題:PHP LoggerInterface::addDebug方法的具體用法?PHP LoggerInterface::addDebug怎麽用?PHP LoggerInterface::addDebug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Psr\Log\LoggerInterface
的用法示例。
在下文中一共展示了LoggerInterface::addDebug方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: dispatch
public function dispatch(\Magento\Framework\App\RequestInterface $request)
{
foreach ($this->_routerList as $router) {
$this->_logger->addDebug(get_class($router));
}
return parent::dispatch($request);
}
示例2: log
/**
*
* @param $message
* @param bool|false $useSeparator
*/
public function log($message, $useSeparator = false)
{
if ($this->getDebugStatus()) {
if ($useSeparator) {
$this->_logger->addDebug(str_repeat('=', 100));
}
$this->_logger->addDebug($message);
}
}
示例3: process
/**
* Returns the the path to the processed image
*
* @param string $sFilter
* @param string $sOptions
* @param string $sFile
*
* @return string
*
* @throws \Exception
*/
public function process($sFilter, $sOptions, $sFile)
{
$this->oLogger->addInfo("filter=" . $sFilter . "; file=" . $sFile);
// check if filter exists
$sFilterClass = "\\Pids\\Filter\\" . ucfirst(strtolower($sFilter));
if (!class_exists($sFilterClass)) {
throw new \Exception("Filter " . $sFilterClass . " does not exist.");
}
$oFilter = new $sFilterClass();
// check if image exists else use default image
if (!file_exists('data' . DIRECTORY_SEPARATOR . $sFile)) {
$sFile = $this->aConfig["image"]["default"];
$this->oLogger->addDebug("using default image");
}
$this->sSourceImage = 'data' . DIRECTORY_SEPARATOR . $sFile;
// check if cache is up to date
$this->sCacheImage = $this->getCachePath($sFilter, $sOptions, $sFile);
if (file_exists($this->sCacheImage) && filemtime($this->sSourceImage) < filemtime($this->sCacheImage)) {
$this->oLogger->addDebug("cache file was up to date");
return $this->sCacheImage;
}
//TODO separate method
$rFinfo = finfo_open(FILEINFO_MIME_TYPE);
$sMime = finfo_file($rFinfo, $this->sSourceImage, FILEINFO_MIME_TYPE);
switch ($sMime) {
case 'image/jpeg':
case 'image/jpg':
$rImage = imagecreatefromjpeg($this->sSourceImage);
break;
case 'image/png':
$rImage = imagecreatefrompng($this->sSourceImage);
break;
default:
throw new \Exception('Unsupported mime type ' . $sMime);
}
// create cache file
$rImage = $oFilter->apply($rImage, $sOptions, $this->aConfig["filters"][strtolower($sFilter)]);
if ($this->aConfig["image"]["watermark"]) {
$rImage = $oFilter->addWatermark($rImage);
}
//TODO separate method
switch ($sMime) {
case 'image/jpeg':
case 'image/jpg':
imagejpeg($rImage, $this->sCacheImage, $this->aConfig["image"]["quality"]);
break;
case 'image/png':
imagepng($rImage, $this->sCacheImage, ceil($this->aConfig["image"]["quality"] / 10));
break;
}
$this->oLogger->addDebug("cache file created:" . $this->sCacheImage);
return $this->sCacheImage;
}
示例4: execute
/**
* Receives webhook events from Roadrunner
*/
public function execute()
{
$this->_logger->addDebug('paystandmagento/webhook/paystand endpoint was hit');
$body = @file_get_contents('php://input');
$json = json_decode($body);
$this->_logger->addDebug(">>>>> body=" . print_r($body, TRUE));
if (isset($json->resource->meta->source) && $json->resource->meta->source == "magento 2") {
$quoteId = $json->resource->meta->quote;
$this->_logger->addDebug('magento 2 webhook identified with quote id = ' . $quoteId);
$this->_order->loadByAttribute('quote_id', $quoteId);
if (!empty($this->_order->getIncrementId())) {
$this->_logger->addDebug('current order increment id = ' . $this->_order->getIncrementId());
$state = $this->_order->getState();
$this->_logger->addDebug('current order state = ' . $state);
$status = $this->_order->getStatus();
$this->_logger->addDebug('current order status = ' . $status);
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
if ($this->scopeConfig->getValue(self::USE_SANDBOX, $storeScope)) {
$base_url = 'https://api.paystand.co/v3';
} else {
$base_url = 'https://api.paystand.com/v3';
}
$url = $base_url . "/events/" . $json->id . "/verify";
$auth_header = array("x-publishable-key: " . $this->scopeConfig->getValue(self::PUBLISHABLE_KEY, $storeScope));
$curl = $this->buildCurl("POST", $url, json_encode($json), $auth_header);
$response = $this->runCurl($curl);
$this->_logger->addDebug("http_response_code is " . $this->http_response_code);
if (FALSE !== $response && $this->http_response_code == 200) {
if ($json->resource->object = "payment") {
switch ($json->resource->status) {
case 'posted':
$state = 'pending';
$status = 'pending';
break;
case 'paid':
$state = 'processing';
$status = 'processing';
break;
case 'failed':
$state = 'closed';
$status = 'closed';
break;
case 'canceled':
$state = 'canceled';
$status = 'canceled';
break;
}
}
$this->_order->setState($state);
$this->_order->setStatus($status);
$this->_order->save();
$this->_logger->addDebug('new order state = ' . $state);
$this->_logger->addDebug('new order status = ' . $status);
} else {
$this->_logger->addDebug('event verify failed');
}
}
}
}
示例5: execute
/**
* @param \Magento\Framework\Event\Observer $observer
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
$response = $observer->getResponse();
$body = $response->getBody();
$this->_logger->addDebug("Flushed output: " . PHP_EOL . $body);
}