本文整理汇总了PHP中Zend_Log_Writer_Stream::_write方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Log_Writer_Stream::_write方法的具体用法?PHP Zend_Log_Writer_Stream::_write怎么用?PHP Zend_Log_Writer_Stream::_write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Log_Writer_Stream
的用法示例。
在下文中一共展示了Zend_Log_Writer_Stream::_write方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _write
protected function _write($event)
{
/* First we will try to write a log entry to database */
if (Mage::helper('inchoo_logger')->isModuleEnabled(Mage::app()->getStore()->getId())) {
$logger = Mage::getModel('inchoo_logger/logger');
$logger->setTimestamp($event['timestamp']);
$logger->setMessage($event['message']);
$logger->setPriority($event['priority']);
$logger->setPriorityName($event['priorityName']);
$logger->setWebsite(Mage::app()->getWebsite()->getId());
$logger->setWebsiteName(Mage::app()->getWebsite()->getName());
$logger->setStore(Mage::app()->getStore()->getId());
$logger->setStoreName(Mage::app()->getStore()->getName());
$logger->setArea(Mage::getSingleton('core/design_package')->getArea());
if (is_string(self::$_ilfp)) {
$logger->setFile(self::$_ilfp);
}
/* Check if admin user is logged in, if it is then add its info to the log entry */
$user = Mage::getSingleton('admin/session')->getUser();
if ($user && $user->getId()) {
$logger->setUser($user->getId());
$logger->setUserEmail($user->getEmail());
}
/* Check if customer is logged in, if it is then add its info to the log entry */
$customer = Mage::getSingleton('customer/session')->getCustomer();
if ($customer && $customer->getId()) {
$logger->setCustomer($customer->getId());
$logger->setCustomerEmail($customer->getEmail());
}
$request = Mage::app()->getRequest();
if ($request instanceof Mage_Core_Controller_Request_Http) {
$dt = new DateTime('now');
/* $dt->format('Y-m-d H:i:s') */
$logger->setCreatedAt($dt->format('Y-m-d H:i:s'));
$logger->setRequestMethod($request->getMethod());
$logger->setRequestModuleName($request->getModuleName());
$logger->setRequestBaseUrl($request->getBaseUrl());
$logger->setRequestRequestUri($request->getRequestUri());
$logger->setRequestControllerName($request->getControllerName());
$logger->setRequestActionName($request->getActionName());
$logger->setRequestClientIp($request->getClientIp());
if (Mage::helper('inchoo_logger')->logRequestParams()) {
if ($params = $request->getParams()) {
$params = serialize($params);
$params = Mage::helper('core')->encrypt($params);
$logger->setRequestParams($params);
}
}
}
try {
$logger->save();
} catch (Exception $e) {
echo $e->getMessage();
exit;
/* Silently die... */
}
}
/* Now pass the execution to original parent code */
return parent::_write($event);
}
示例2: _write
protected function _write($event)
{
if (Mage::getStoreConfigFlag(Eschrade_PubSubLogger_Model_Observer::SYSTEM_CONFIG_ENABLED)) {
$message = $this->_formatter->format($event);
$this->logDirect($message);
if (Mage::getStoreConfigFlag(Eschrade_PubSubLogger_Model_Observer::SYSTEM_CONFIG_PASSTHRU)) {
return parent::_write($event);
}
} else {
return parent::_write($event);
}
}
示例3: _write
/**
* log writter
*
* @param array $event
* @return void
*/
protected function _write($event)
{
if ($this->_shouldLog()) {
parent::_write($event);
}
if (FALSE !== strpos($this->_logfile, self::EXCEPTION_LOG)) {
$message = strtok($event['message'], "\n");
if (!empty($message)) {
Mage::getSingleton('flagbit_monitoring/agent')->send($message, Mage::helper('flagbit_monitoring')->getMapping('EXCEPTION'));
}
}
}
示例4: _write
protected function _write($event)
{
$ip = Zend_Controller_Action_HelperBroker::getStaticHelper('Currentip');
$event['ip_client'] = $ip->getCurrentIp();
$event['ip_host'] = $_SERVER['SERVER_ADDR'];
$event['created_by'] = Zend_Auth::getInstance()->getIdentity()->id;
$event['id_branch'] = Zend_Auth::getInstance()->getIdentity()->id_branch;
$event['request_headers'] = Zend_Json::encode(getallheaders());
$event['url'] = 'http' . (empty($_SERVER['HTTPS']) ? '' : 's') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$event['request_parameters'] = Zend_Json::encode($_REQUEST);
$event['request_hash'] = $this->getRequestHash();
parent::_write($event);
}
示例5: _write
protected function _write($event)
{
try {
parent::_write($event);
} catch (Zend_Log_Exception $e) {
//if resource is closed (happens during shutdown), re-open
if (!is_resource($this->_stream)) {
if (!($this->_stream = @fopen($this->_url, $this->_mode, false))) {
throw $e;
}
parent::_write($event);
}
}
}
示例6: _write
/**
* Write a message to the log.
*
* @param array $event event data
* @return void
*/
protected function _write($event)
{
parent::_write($event);
// Log to NewRelic
self::_log_to_newrelic($event);
}
示例7: _write
/**
* @see Zend_Log_Writer_Stream::_write
* @param array $event
* Overriding this method in order to send email logging if enabled in the backend.
*/
protected function _write($event)
{
// allow logging at the config level where the priority is less or equal to the admin config log level.
if (isset($event['priority']) && $event['priority'] <= $this->_getConfig()->getLogLevel()) {
parent::_write($event);
}
// proceed to send logging e-mail
$this->_sendLoggingEmail($event);
}
示例8: _write
/**
* Store alerts for log messages
*
* @param array $event
* event data
* @return void
* @throws Zend_Log_Exception
*/
protected function _write($event)
{
if ($this->_log) {
$helper = Mage::helper('storealerts');
$priority = $event['priority'];
if ($helper->logPriority($priority)) {
$message = trim($event['message']);
$exception = substr($message, 0, 9);
if ($exception == 'exception') {
$matches = array();
preg_match_all("/'([^']+)'/", $message, $matches);
if (count($matches) == 2) {
$quotedStrings = $matches[1];
if (is_array($quotedStrings) && count($quotedStrings) > 1) {
$exceptionType = strtolower($quotedStrings[0]);
$exceptionMessage = $quotedStrings[1];
if (is_numeric(strpos($exceptionType, 'exception')) && $exceptionMessage) {
$exceptionMsg = $exceptionMessage;
}
}
}
}
$exploded = isset($exceptionMsg) ? explode(":", $exceptionMsg) : explode(":", $message);
$type = $exploded[0];
if ($type) {
$type = trim($type);
switch ($type) {
case "Error":
$priority = Zend_Log::ERR;
break;
case "Warning":
$priority = Zend_Log::WARN;
break;
case "Parse Error":
$priority = Zend_Log::ERR;
break;
case "Notice":
$priority = Zend_Log::NOTICE;
break;
case "Core Error":
$priority = Zend_Log::ERR;
break;
case "Core Warning":
$priority = Zend_Log::WARN;
break;
case "Compile Error":
$priority = Zend_Log::ERR;
break;
case "Compile Warning":
$priority = Zend_Log::WARN;
break;
case "User Error":
$priority = Zend_Log::ERR;
break;
case "User Warning":
$priority = Zend_Log::WARN;
break;
case "User Notice":
$priority = Zend_Log::NOTICE;
break;
case "Strict Notice":
$priority = Zend_Log::DEBUG;
break;
case "Recoverable Error":
$priority = Zend_Log::ERR;
break;
case "Deprecated functionality":
$priority = Zend_Log::DEBUG;
break;
case "Payment authorization error":
$priority = Zend_Log::DEBUG;
break;
default:
break;
}
}
$title = trim(substr($message, 0, 80));
$title .= strlen($message) > 80 ? '...' : '';
$helper->saveAlert(ExtensionsStore_StoreAlerts_Model_Alert::LOG, $message, $title);
}
}
parent::_write($event);
}