public function errorAction() { $errors = $this->_getParam('error_handler'); $logger = new Zend_Log(); $writer = new Zend_Log_Writer_Stream(dirname(APPLICATION_PATH) . '/logs/exceptions.log'); $logger->addWriter($writer); //$logger->addWriter(new Keplin_Log_Writer_Email()); switch ($errors->type) { case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: // 404 error -- controller or action not found $this->getResponse()->setHttpResponseCode(404); $this->view->message = 'Page not found'; $logger->log($errors->exception->getMessage(), Zend_Log::NOTICE); break; default: // application error $this->getResponse()->setHttpResponseCode(500); $this->view->message = 'Application error'; if (get_class($errors->exception) == 'Keplin_ProhibitedException') { $this->view->message = 'Access Prohibited.'; $logger->log($errors->exception->getMessage(), Zend_Log::WARN); } else { $logger->log($errors->exception->getMessage(), Zend_Log::ERR); } break; } // conditionally display exceptions if ($this->getInvokeArg('displayExceptions') == true) { $this->view->exception = $errors->exception; } $this->view->request = $errors->request; }
private function logUpdate($eventType, $table, $oldValue, $newValue, $user) { $timestamp = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss'); if ($this->trackFields != null) { // insert a log for each tracked field foreach ($this->trackFields as $field) { if (isset($oldValue[$field]) && isset($newValue[$field])) { if ($oldValue[$field] != $newValue[$field]) { $this->setColEventType(self::EVENT_TYPE_UPDATE); $this->setColEventDate($timestamp); $this->setColFieldName($field); $this->setColRecordId($oldValue['id']); $this->setColAppAccountId($user['appaccount_id']); $this->setColUserId($user['user_id']); $this->setColTableName($table); $this->setColFieldTextType(false); $this->setColValue($oldValue[$field]); $this->log->log('UPDATE on database', Zend_Log::INFO); } } } } else { throw new Agana_Exception('Track Fields for audit trail is not set'); } }
public function echoAction() { $console = $this->getConsoleOptions(array('name|n=s' => 'Tell me your name')); $message = 'Hello ' . $console->getOption("name"); echo $message, "\n"; $this->_logger->log($message, Zend_Log::INFO); exit(0); }
/** * Logs with an arbitrary level. * * @param int $level * @param string $message * @param array $context * * @return null */ public function log($level, $message, array $context = []) { if (!isset($this->logMap[$level])) { throw new \InvalidArgumentException('Level is not supported. See "Psr\\Log\\LogLevel"'); } $zendLogLevel = $this->logMap[$level]; //Proxy log $this->logger->log($message, $zendLogLevel); }
/** * calls prent _write and and writes temp log file * * @param array $event Event data * @return void */ protected function _write($event) { if (!is_file($this->_tempfile)) { @\Pimcore\File::put($this->_tempfile, "... continued ...\r\n"); $writerFile = new \Zend_Log_Writer_Stream($this->_tempfile); $this->_tempLogger = new \Zend_Log($writerFile); } $this->_tempLogger->log($event['message'], $event['priority']); parent::_write($event); }
public function indexAction() { // writer $writer = new Zend_Log_Writer_Firebug(); // log $log = new Zend_Log($writer); // messages $log->log($_REQUEST, Zend_Log::ERR); $log->log($_ENV, Zend_Log::ALERT); $log->log($_SERVER, Zend_Log::ALERT); }
/** * calls prent _write and and writes temp log file * * @param array $event Event data * @return void */ protected function _write($event) { if (!is_file($this->_tempfile)) { $fh = @fopen($this->_tempfile, 'a'); @fwrite($fh, "... continued ...\r\n"); @fclose($fh); $writerFile = new Zend_Log_Writer_Stream($this->_tempfile); $this->_tempLogger = new Zend_Log($writerFile); } $this->_tempLogger->log($event['message'], $event['priority']); parent::_write($event); }
/** * Required by ZIDS_Plugin_ActionPlugin_Interface * Writes output to Zend_Log instance registered * * @return void */ public function fires(IDS_Report $ids_result, $impact, $levelname) { // get options for the log plugin $options = $this->getOptions($levelname); // parse log->items parameters $this->_logitems = explode(',', $options['items']); array_walk($this->_logitems, create_function('&$arr', '$arr=trim($arr);')); if (null == $this->_log) { throw new Exception('ZIDS cannot use the log action unless you register a Zend_Log instance.'); } $this->_log->log($this->getNotificationString($impact, $ids_result, $levelname), $options['loglevel']); }
/** * @param string $websiteId * @param string $id * @param string $name * @param string $additionalinfo * @param integer $timestamp * @param string $userid * @param string $action * @param integer $priority */ protected function log($websiteId, $id, $name, $additionalinfo, $timestamp, $userlogin, $action, $priority = \Zend_Log::INFO) { if ((int) $priority > (int) $this->level) { return; } $this->logger->setEventItem('websiteid', $websiteId); $this->logger->setEventItem('id', $id); $this->logger->setEventItem('name', $name); $this->logger->setEventItem('additionalinfo', $additionalinfo); $this->logger->setEventItem('timestamp', $timestamp); $this->logger->setEventItem('userlogin', $userlogin); $this->logger->setEventItem('action', $action); $this->logger->log($action, $priority); }
/** * Log a message. * * @param string $message * @param string $type */ public function log($message, $type = null) { if (isset($message['type']) && !isset($type)) { $type = $message['type']; } unset($message['type']); if (is_array($message)) { $message = count($message) == 1 ? reset($message) : '[' . join('] [', $message) . ']'; } try { $this->zendlog->log($message, isset($this->alias[$type]) ? $this->alias[$type] : $this->alias[null]); } catch (\Exception $e) { trigger_error('Logging using ' . get_class($this->zendlog) . ' failed: ' . $e->getMessage(), E_USER_WARNING); } }
public function preDispatch($request) { try { $locale = new Zend_Locale(); $locale->setDefault('en'); $locale->setLocale(Zend_Locale::BROWSER); $requestedLanguage = key($locale->getBrowser()); $formatter = new Zend_Log_Formatter_Simple('%message%' . PHP_EOL); $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'translations.log'); $writer->setFormatter($formatter); $logger = new Zend_Log($writer); $frontendOptions = array('cache_id_prefix' => 'translation', 'lifetime' => 86400, 'automatic_serialization' => true); $backendOptions = array('cache_dir' => APPLICATION_CACHE_PATH); $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); $options = array('adapter' => 'gettext', 'scan' => Zend_Translate::LOCALE_FILENAME, 'content' => APPLICATION_PATH . '/languages/en/en.mo', 'locale' => 'auto', 'disableNotices' => true); $translate = new Zend_Translate($options); if (!$translate->isAvailable($locale->getLanguage())) { $locale->setLocale('en'); } else { $translate->setLocale($locale); } $translate->setCache($cache); Zend_Registry::set('locale', $locale->getLanguage()); Zend_Registry::set('Zend_Translate', $translate); } catch (Exception $e) { try { $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'plugin-locale.log'); $logger = new Zend_Log($writer); $logger->log($e->getMessage(), Zend_Log::ERR); } catch (Exception $e) { } } }
protected function _initLog() { $log = new Zend_Log(); $log->setEventItem('domain', 'error'); // Non-production if (APPLICATION_ENV !== 'production') { $log->addWriter(new Zend_Log_Writer_Firebug()); } // Get log config try { $log->addWriter(new Zend_Log_Writer_Stream(WEB_ROOT . '/temporary/log/main.log')); } catch (Exception $e) { // Check directory if (!@is_dir(WEB_ROOT . '/temporary/log') && @mkdir(WEB_ROOT . '/temporary/log', 0777, true)) { $log->addWriter(new Zend_Log_Writer_Stream(WEB_ROOT . '/temporary/log/main.log')); } else { // Silence ... if (APPLICATION_ENV !== 'production') { $log->log($e->__toString(), Zend_Log::CRIT); } else { // Make sure logging doesn't cause exceptions $log->addWriter(new Zend_Log_Writer_Null()); } } } // Save to registry Zend_Registry::set('Zend_Log', $log); return $log; }
/** * PreDispatch method for ACL Plugin. It checks if current user has privileges for resources requested * @see Zend_Controller_Plugin_Abstract::preDispatch() * @param Zend_Controller_Request_Abstract $request */ public function preDispatch(Zend_Controller_Request_Abstract $request) { try { $module = strtolower($request->getParam('module')); $controller = strtolower($request->getParam('controller')); $action = strtolower($request->getParam('action')); $resource = $module . ":" . $controller; $acl = Zend_Registry::get('ZendACL'); $auth = Zend_Auth::getInstance(); $identity = $auth->getIdentity(); $roleID = $auth->hasIdentity() ? $auth->getIdentity()->role_id : 3; #var_dump($acl->isAllowed( $roleID, $resource, $action), $roleID, $resource, $action); #Zend_Debug::dump($module, $controller, $action, $roleID, $acl); #die(); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); if ($acl->isAllowed($roleID, $resource, $action) != true) { $redirector->gotoUrl('logout')->redirectAndExit(); } else { return; } } catch (Exception $e) { try { $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'plugins.log'); $logger = new Zend_Log($writer); $logger->log($e->getMessage(), Zend_Log::ERR); } catch (Exception $e) { } } }
/** * Logs the message to the log with the given priority. * * This method only works if the Log Level is higher than the given priority. * If there is no logger object than this method will instantiate it. * In contrary to the debug statement this only logs strings. * * @see DocBlock_Abstract::setLogLevel() * @see Zend_Log * @param string $message * @return void */ public function log($message, $priority = Zend_Log::INFO) { // is the log level is below the priority; just skip this if ($this->getLogLevel() < $priority) { return; } if ($priority == Zend_Log::DEBUG) { $this->debug($message); return; } if (!self::$logger) { $file = str_replace(array('{DATE}'), array(date('YmdHis')), $this->getConfig()->logging->paths->default); self::$logger = new Zend_Log(new Zend_Log_Writer_Stream(fopen($file, 'w'))); } static $priority_names = null; if ($priority_names === null) { $r = new ReflectionClass('Zend_Log'); $priority_names = array_flip($r->getConstants()); } $debug_info = ($this->getLogLevel() == Zend_Log::DEBUG) ? ', '.round(memory_get_usage() / 1024 / 1024, 2).'mb' : ''; echo '['.$priority_names[$priority].': '.date('H:i').$debug_info.']: '.$message.PHP_EOL; self::$logger->log($message, $priority); }
private function log() { $dir = APP_PATH . '/logs/request'; if (!is_dir($dir)) { mkdir($dir, 0755); } $file = $dir . '/' . date('Y-m-d') . '.log'; $logger = new \Zend_Log(); $formatter = new \Zend_Log_Formatter_Simple("%message%\n"); $writer = new \Zend_Log_Writer_Stream($file); $writer->setFormatter($formatter); $logger->addWriter($writer); $data = array(); $data[] = '[' . date('Y-m-d H:i:s') . '] '; $url = Http::getUrl('current'); $url = substr($url, 0, strpos($url, '?')) . '?' . http_build_query($this->getRequest()->getRequest()); $data[] = $url; $line = implode('', $data); $debug = Application::app()->getConfig()->debug; if ($debug) { $res = $this->getResponse()->getBody('api'); $line .= "\n\t" . $res; } $logger->log($line, $logger::NOTICE); }
public function log($message, $priority, $extras = null) { if ($this->stream !== null && $this->stream !== "system") { $message = $this->stream . " " . $message; } parent::log($message, $priority, $extras); }
/** * (non-PHPdoc) * @see Zend_Controller_Plugin_Abstract::preDispatch() */ public function preDispatch(Zend_Controller_Request_Abstract $request) { try { $layout = Zend_Layout::getMvcInstance()->getLayout(); $boostrap = Zend_Controller_Front::getInstance()->getParam('bootstrap'); $userAgent = $boostrap->getResource('useragent'); $device = $userAgent->getDevice(); $mdlSkin = new System_Model_Skin(); $skin = $mdlSkin->getSkinSelected(); $skinName = is_null($skin) ? 'default' : strtolower($skin->name); $vr = Zend_Controller_Action_HelperBroker::getStaticHelper('Layout'); $view = $vr->getView(); $skinData = new Zend_Config_Xml('./skins/' . $skinName . '/skin.xml'); # css files $stylesheet = (int) $device->getFeature('is_desktop') == 1 ? $skinData->files->stylesheet : $skinData->files->stylesheetMobile; $view->headLink()->prependStylesheet($view->baseUrl() . '/skins/' . $skinName . '/css/' . $stylesheet); $view->headLink()->headLink(array('rel' => 'favicon', 'href' => $view->baseUrl() . '/skins/' . $skinName . '/favicon.ico'), 'PREPEND'); Zend_Registry::set('skin', $skinName); # javascript files $jsfiles = $skinData->files->js->toArray(); foreach ($jsfiles as $js) { $view->headScript()->prependFile($view->baseUrl() . '/skins/' . $skinName . '/js/' . $js); } } catch (Exception $e) { try { $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'plugins.log'); $logger = new Zend_Log($writer); $logger->log($e->getMessage(), Zend_Log::ERR); } catch (Exception $e) { } } }
/** * @param $lty_id Tipo do Log / Tabela log_type / 1 Geral / 2 Usuário logado / 3 Administrador logado * (non-PHPdoc) * @see Zend_Log::log() */ public function log($message, $priority, $extras = null) { $data = array('lty_id' => 1, 'log_ip' => $_SERVER['REMOTE_ADDR'], 'log_userAgent' => $_SERVER['HTTP_USER_AGENT']); /* //Envio de e-mail em caso de erro crítico, Emergency ou Alerta if ($priority <= Zend_Log::CRIT) { $strEmails = Zend_Registry::get('config')->erroEmergencialAlerta; if ($strEmails != '') { $emails = explode(',', Zend_Registry::get('config')->erroEmergencialAlerta); } if(!empty($emails)) { try { Inter_Util_Controller_Action_Helper_InterMail::send( $emails, 'Erro Emergencial Comunidade', '_messages/eml_mailSend.phtml', array( 'msg_message' => $additional_message ), '_messages/eml_mailSend.phtml' ); } catch (Exception $e) { //var_dump($e->getMessage()); } } } */ return parent::log($message, $priority, $data); }
function preDispatch(Zend_Controller_Request_Abstract $request) { try { require_once 'IDS/Init.php'; require_once 'IDS/Log/Composite.php'; require_once 'IDS/Log/Database.php'; #require_once 'IDS/Log/File.php'; $request = array('REQUEST' => $_REQUEST, 'GET' => $_GET, 'POST' => $_POST, 'COOKIE' => $_COOKIE); $init = IDS_Init::init(APPLICATION_PATH . '/../library/phpids/lib/IDS/Config/Config.ini.php'); $ids = new IDS_Monitor($request, $init); $result = $ids->run(); if (!$result->isEmpty()) { // This is where you should put some code that // deals with potential attacks, e.g. throwing // an exception, logging the attack, etc. $compositeLog = new IDS_Log_Composite(); $compositeLog->addLogger(IDS_Log_Database::getInstance($init)); #$compositeLog->addLogger(IDS_Log_File::getInstance($init)); $compositeLog->execute($result); echo $result; die('<h1>Go away!</h1>'); #$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); #$redirector->gotoUrl('default/error/error/eh/ids')->redirectAndExit(); } return $request; } catch (Exception $e) { try { $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'plugin-ids.log'); $logger = new Zend_Log($writer); $logger->log($e->getMessage() . ' line ' . $e->getLine() . ' file ' . $e->getFile(), Zend_Log::ERR); } catch (Exception $e) { } } }
/** * Log a message at a priority * * @param string $message Message to log * @param integer $priority Priority of message * @param mixed $extras Extra information to log in event * @return void * @throws Zend_Log_Exception */ public function log($message, $priority = Zend_Log::DEBUG, $extras = null) { if ($this->stamp) { $message = '[' . $this->stamp . '] ' . $message; } parent::log($message, $priority, $extras); }
/** * Check the application.ini file for security settings. * If the url requires being secured, rebuild a secure url * and redirect. * * @param Zend_Controller_Request_Abstract $request * @return void * @author Travis Boudreaux */ public function preDispatch(Zend_Controller_Request_Abstract $request) { try { $shouldSecureUrl = false; $options = Zend_Registry::getInstance()->get('options'); // ar_dump($options['ssl'][$request->module][$request->controller][$request->action]['require_ssl']); // ie(); // f (APPLICATION_ENV == ENV_PRODUCTION ) { // check configuration file for one of three require_ssl directives // secure an entire module with modules.module_name.require_ssl = // true // secure an entire controller with // modules.module_name.controller_name.require_ssl = true // secure an action with // modules.module_name.controller_name.action_name.require_ssl = // true if (@$options['ssl'][$request->module]['require_ssl'] || @$options['ssl'][$request->module][$request->controller]['require_ssl'] || @$options['ssl'][$request->module][$request->controller][$request->action]['require_ssl']) { $shouldSecureUrl = true; } if ($shouldSecureUrl) { $this->_secureUrl($request, true); } else { $this->_secureUrl($request, false); } // } catch (Exception $e) { try { $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'plugins.log'); $logger = new Zend_Log($writer); $logger->log($e->getMessage(), Zend_Log::ERR); } catch (Exception $e) { } } }
protected function _initLog() { $log = new Zend_Log(); // Non-production if (APPLICATION_ENV !== 'production') { $log->addWriter(new Zend_Log_Writer_Firebug()); } // Production try { $log->addWriter(new Zend_Log_Writer_Stream(APPLICATION_PATH . '/temporary/log/install.log')); } catch (Exception $e) { // Check directory if (!@is_dir(APPLICATION_PATH . '/temporary/log') && @mkdir(APPLICATION_PATH . '/temporary/log', 0777, true)) { $log->addWriter(new Zend_Log_Writer_Stream(APPLICATION_PATH . '/temporary/log/install.log')); } else { // Silence ... if (APPLICATION_ENV !== 'production') { $log->log($e->__toString(), Zend_Log::CRIT); } else { // Make sure logging doesn't cause exceptions $log->addWriter(new Zend_Log_Writer_Null()); } } } Zend_Registry::set('Zend_Log', $log); Engine_Api::registerErrorHandlers(); if ('production' != APPLICATION_ENV) { Engine_Exception::setLog($log); } return $log; }
/** * Log something. * * @param string $msg * @param int $severity */ public function log($msg = null, $severity = Zend_Log::DEBUG) { if ($msg == null) { return $this->logger; } $this->logger->log($msg, $severity); }
/** * Inject logging logic * @see Exception */ public function __construct($message = '', $code = 0, Exception $previous = null) { if (version_compare(PHP_VERSION, '5.3.0') >= 0) { // Add previous if we're >= 5.3.0 parent::__construct((string) $message, (int) $code, $previous); } else { parent::__construct((string) $message, (int) $code); } if (null !== self::$_log) { self::$_log->log($this->__toString(), Zend_Log::WARN); } if (true === self::$_exitImmediately) { echo $this->__toString(); die; } }
public function logException($exception, $priority, $extras = null) { $extras['hierarchy'] = Zend_Json::encode($exception->getPrevious()); $extras['line'] = $exception->getLine(); $extras['file'] = $exception->getFile(); $extras['xdebug_message'] = $exception->xdebug_message; parent::log($exception->getMessage(), $priority, $extras); }
/** * */ protected function _initRestRoute() { // Info Log $this->_logging->log('RestRoute initialized...', Zend_Log::INFO); $front = Zend_Controller_Front::getInstance(); $restRoute = new Zend_Rest_Route($front, array(), array('kebab' => array('session', 'password', 'forgot-password', 'story', 'feedback', 'feedback-manager', 'profile', 'role', 'role-story', 'user', 'user-role', 'user-sign-up', 'user-activation', 'user-invitation', 'application'))); $front->getRouter()->addRoute('rest', $restRoute); }
/** * Log that pesky error to a file * * @param ArrayObject $errors * @return void */ public static function logErrorToFile($errors) { $errorMessage = self::_composeFullErrorMessage($errors); $stream = fopen(APPLICATION_PATH . '/data/logs/errors.log', 'a'); $writer = new Zend_Log_Writer_Stream($stream); $logger = new Zend_Log($writer); $logger->log($errorMessage, Zend_Log::ALERT); }
/** * constructor method * * @author Eddie Jaoude * @param void * @return void * */ public function __construct($message, $level) { if (APPLICATION_ENV == 'development') { $writer = new Zend_Log_Writer_Firebug(); $logger = new Zend_Log($writer); $logger->log($message, $level); } }
/** * (non-PHPdoc) * @see Zend_Controller_Plugin_Abstract::preDispatch() */ public function preDispatch(Zend_Controller_Request_Abstract $request) { try { #Zend_Debug::dump($request->getParams()); #die(); $mdlRole = new Acl_Model_Role(); $auth = Zend_Auth::getInstance(); $acl = Zend_Registry::get('ZendACL'); if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); $this->role = $mdlRole->find($identity->role_id)->current(); } else { $this->role = $mdlRole->find(3)->current(); } $mdlMenuItem = new menu_Model_Item(); $mdlMenu = new menu_Model_Menu(); $navLinks = array(); $nav = new Zend_Navigation($navLinks); $menuList = $mdlMenu->getByStatus(1); foreach ($menuList as $menu) { $options = array('id' => 'menu-' . $menu->id, 'label' => $menu->name, 'uri' => ''); $page = Zend_Navigation_Page::factory($options); $nav->addPage($page); $menuitemList = $mdlMenuItem->getItemsForNavigationByMenu($menu); foreach ($menuitemList as $menuItem) { if ($menuItem->parent_id == 0) { if ($menuItem->external == 1) { $this->addExternalPage($page, $menuItem); } else { $this->addInternalPage($page, $menuItem); } } else { $parent = $nav->findBy('id', 'mii-' . $menuItem->parent_id); if ($menuItem->external == 1) { $this->addExternalPage($parent, $menuItem); } else { $this->addInternalPage($parent, $menuItem); } } } } $this->addCurrentPageUnregistered($nav, $request); $page = $nav->findBy("id", "mii-" . $request->getParam("mid")); if ($page) { $page->setActive(true); } Zend_Registry::set('Zend_Navigation', $nav); #Zend_Debug::dump($nav->toArray()); #die(); } catch (Exception $e) { try { $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'plugins.log'); $logger = new Zend_Log($writer); $logger->log($e->getMessage(), Zend_Log::ERR); } catch (Exception $e) { } } }
/** * Logs a message to the error log along with its trace. * The backtrace is automatically retrieved, even if the entry is a string, so NO backtrace * information should be provided in the message. However, if you need to save other context * data, as the URL, HTTP headers, or ENV variables, these should be part of the message. * * @param mixed $entry Can be of type string, ErrorException or Exception * @param int $priority One of the Cli_Service_Log class constants. * @param bool $addTrace Whether to add a trace to log message. */ public static function log($entry, $priority = self::ERR, $addTrace = true) { if (!self::$_logger) { self::$_logger = Zend_Registry::get('errorLog'); } $logData = array('message' => '', 'priority' => $priority); if ($entry instanceof ErrorException) { $severity = $entry->getSeverity(); switch ($severity) { case E_NOTICE: $logData['priority'] = self::NOTICE; break; case E_WARNING: $logData['priority'] = self::WARN; break; case E_ERROR: default: $logData['priority'] = self::ERR; break; } if ($addTrace) { $logData['message'] = ''; $traceString = str_replace("#", "\t#", $entry->getTraceAsString()); $logData['message'] .= $entry->getMessage() . PHP_EOL . $traceString . PHP_EOL; } else { $logData['message'] = $entry->getMessage(); } } elseif ($entry instanceof Exception) { // add a tab beofre each new line of the trace string $logData['priority'] = $entry->getCode(); if ($addTrace) { $logData['message'] = ''; $traceString = str_replace("#", "\t#", $entry->getTraceAsString()); $logData['message'] .= $entry->getMessage() . PHP_EOL . $traceString . PHP_EOL; } else { $logData['message'] = $entry->getMessage(); } } elseif (is_string($entry)) { if ($addTrace) { $rawBacktrace = debug_backtrace(); $formattedBacktrace = self::_getFormattedBacktrace($rawBacktrace); $logData['message'] = $entry . PHP_EOL . $formattedBacktrace; } else { $logData['message'] = $entry; } } else { throw new BadMethodCallException('Logging service called with unknown entry type: ' . gettype($entry)); } if ($logData['priority'] >= self::EMERG && $logData['priority'] <= self::DEBUG) { self::$_logger->log($logData['message'], $logData['priority']); } else { self::$_logger->err($logData['message']); } if (ini_get('display_errors')) { echo $logData['message'] . PHP_EOL; } }