public function log($priority, $message, $area, $backTrace = null) { if (!self::isValidPriority($priority)) { throw new Exception("Invalid logging priority {$priority}"); } if (!preg_match("/^[a-z0-9_-]+\$/i", $area)) { throw new Exception("Invalid area {$area}"); } //don't log items above the current logging level $loggingLevel = isset($this->areaLevel[$area]) ? $this->areaLevel[$area] : $this->defaultLevel; if ($priority > $loggingLevel) { return; } if (!$backTrace) { $backTrace = debug_backtrace(); } $compactTrace = self::compactTrace($backTrace); if (isset($_SERVER['REQUEST_URI'])) { $request = $_SERVER['REQUEST_URI']; } elseif (defined('KUROGO_SHELL')) { $request = json_encode(Kurogo::getArrayForRequest()); } else { $request = null; } $content = sprintf("%s\t%s:%s\t%s\t%s\t%s", date(Kurogo::getSiteVar('LOG_DATE_FORMAT')), $area, self::priorityToString($priority), $compactTrace, $request, $message) . PHP_EOL; self::fileAppend($this->logFile, $content); }
/** */ function getErrorURL($exception, $devError = false) { if (!defined('URL_PREFIX')) { return false; //the error occurred VERY early in the init process } $args = array_merge(array('code' => $exception instanceof KurogoException ? $exception->getCode() : 'internal'), Kurogo::getArrayForRequest()); if ($devError) { $args['error'] = $devError; } return URL_PREFIX . 'error/?' . http_build_query($args); }
/** */ function getErrorURL($exception, $devError = false) { if (!defined('URL_PREFIX')) { return false; //the error occurred VERY early in the init process } $requestArgs = Kurogo::getArrayForRequest(); $args = array_merge(array('code' => $exception instanceof KurogoException ? $exception->getCode() : 'internal'), $requestArgs); if (array_key_exists(WebModule::AJAX_PARAMETER, $requestArgs['args'])) { $args[WebModule::AJAX_PARAMETER] = $requestArgs['args'][WebModule::AJAX_PARAMETER]; } if ($devError) { $args['error'] = $devError; } return URL_PREFIX . 'error/?' . http_build_query($args); }