本文整理汇总了PHP中Magento\Framework\Logger::logFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::logFile方法的具体用法?PHP Logger::logFile怎么用?PHP Logger::logFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Logger
的用法示例。
在下文中一共展示了Logger::logFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
* Perform forced log data to file
*
* @param mixed $data
* @return $this
*/
public function log($data = null)
{
if ($data === null) {
$data = $this->_data;
} else {
if (!is_array($data)) {
$data = array($data);
}
}
$data = $this->_filterDebugData($data);
$data['__pid'] = getmypid();
$this->_logger->logFile($data, \Zend_Log::DEBUG, $this->_logFileName);
return $this;
}
示例2: addException
/**
* Not Magento exception handling
*
* @param \Exception $exception
* @param string $alternativeText
* @param string $group
* @return $this
*/
public function addException(\Exception $exception, $alternativeText, $group = null)
{
$message = sprintf('Exception message: %s%sTrace: %s', $exception->getMessage(), "\n", $exception->getTraceAsString());
$this->logger->logFile($message, \Zend_Log::DEBUG, Logger::LOGGER_EXCEPTION);
$this->addMessage($this->messageFactory->create(MessageInterface::TYPE_ERROR, $alternativeText), $group);
return $this;
}
示例3: testLogFile
public function testLogFile()
{
$message = ['Wrong file name', 'Avoid using special chars'];
$filename = 'custom_file.log';
$this->model->logFile($message, \Zend_Log::DEBUG);
$this->model->logFile($message, \Zend_Log::DEBUG, $filename);
$this->assertTrue($this->model->hasLog($filename));
}