本文整理汇总了PHP中ErrorHandler::log方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::log方法的具体用法?PHP ErrorHandler::log怎么用?PHP ErrorHandler::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::log方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autoEnvironment
private static function autoEnvironment()
{
if (php_sapi_name() === 'cli') {
return 'development';
}
// A simple “Host:” header is one that does not have a TLD or whose TLD is one of local, home, or xip.io or coincides with the listening address (meaning it’s addressed by IP only).
$bSimpleHost = false;
if (isset($_SERVER['HTTP_HOST'])) {
// As it’s simple HTTP header, this could be easily faked by the client but then this installation would be reachable by plain HTTP 1.0, which modern setups (vhosts) aren’t.
$bSimpleHost = strpos($_SERVER['HTTP_HOST'], '.') === false;
if (!$bSimpleHost) {
$sTLD = explode('.', $_SERVER['HTTP_HOST']);
$sTLD = array_pop($sTLD);
$bSimpleHost = in_array($sTLD, array('local', 'home')) || StringUtil::endsWith($_SERVER['HTTP_HOST'], '.xip.io');
}
if (!$bSimpleHost && isset($_SERVER['SERVER_ADDR'])) {
$bSimpleHost = $_SERVER['HTTP_HOST'] === $_SERVER['SERVER_ADDR'];
}
}
// A simple server is defined as one that listens only on loopback or whose listening address coincides with the client address (CAUTION: may also be true on reverse-proxy environments)
$bSimpleServer = false;
if (isset($_SERVER['SERVER_ADDR'])) {
$bSimpleServer = $_SERVER['SERVER_ADDR'] === '127.0.0.1' || $_SERVER['SERVER_ADDR'] === '::1';
if (!$bSimpleServer && isset($_SERVER['REMOTE_ADDR'])) {
$bSimpleServer = $_SERVER['SERVER_ADDR'] === $_SERVER['REMOTE_ADDR'];
}
}
if ($bSimpleHost && $bSimpleServer) {
return 'development';
}
// A test host is one whose host name starts is on one of the following subdomains: test, stage, staging, integration
$bTestHost = false;
if (isset($_SERVER['HTTP_HOST']) && strpos($_SERVER['HTTP_HOST'], '.') !== false) {
$sSubDomain = explode('.', $_SERVER['HTTP_HOST']);
$sSubDomain = $sSubDomain[0];
$bTestHost = in_array($sSubDomain, array('test', 'stage', 'staging', 'integration'));
}
if ($bTestHost) {
return 'staging';
}
ErrorHandler::log("WARNING: RAPILA_ENVIRONMENT autodetection found “production”. Please configure manually if really a production environment.");
return 'production';
}
示例2: logException
/**
* Exception handler
*
* @param Exception $e
*/
public static function logException(\Exception $e)
{
$message = "Exception " . get_class($e) . " from " . $e->getFile() . " in line " . $e->getLine() . " : " . $e->getMessage();
ErrorHandler::log($message, $e->getMessage());
}
示例3: setLogSettings
public static function setLogSettings($use, $type = ErrorHandler::LOG_SYSTEM, $destination = 'php_error.log')
{
self::$log = $use;
self::$log_type = $type;
self::$log_destination = $destination;
}