本文整理汇总了PHP中Log::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::log方法的具体用法?PHP Log::log怎么用?PHP Log::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Logs the event
*
* @param array $event Array containing 'name' and 'data' keys
*
* @return void
*/
public function update(array $event)
{
if (!in_array($event['name'], $this->events)) {
return;
}
$this->log->log($event['name'] . ":\n");
$this->log->log($event['data']);
}
示例2: phpErrorHandler
function phpErrorHandler($severity, $message, $filename, $lineno)
{
switch ($severity) {
case E_ERROR:
case E_WARNING:
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_WARNING:
case E_USER_WARNING:
if (LOGGING) {
Log::logException(LoggingConstants::ERROR, "Unexpected error", ErrorException($message, 0, $severity, $filename, $lineno));
}
break;
case E_RECOVERABLE_ERROR:
case E_USER_ERROR:
$exception = new ErrorException($message, 0, $severity, $filename, $lineno);
if (LOGGING) {
Log::logException(LoggingConstants::ERROR, "Unexpected error", $exception);
}
throw $exception;
break;
case E_USER_NOTICE:
case E_NOTICE:
if (LOGGING) {
Log::log(LoggingConstants::INFO, "PHP notice: {$message}, file:{$filename}, line:{$lineno}");
}
break;
default:
if (LOGGING) {
Log::log(LoggingConstants::DEBUG, "PHP notice: {$message}, file:{$filename}, line:{$lineno}");
}
}
}
示例3: loadClass
public static function loadClass($class, $dirs = null)
{
// make a recursive directoryiterator
$config = Zend_Registry::getInstance()->configuration;
$from_path = $config->webapp ? $config->webapp->modules ? realpath($config->webapp->modules->path) : null : null;
if ($from_path) {
$i = new RecursiveIteratorIterator(new FilenameFilterIterator($from_path, array('.svn', '.hc', '.cvs')));
// Scan the modules folder and attempt to find the class
Log::log("ModuleLoader ; Scanning for {$class} in directory \"{$from_path}\".", Log::DEBUG);
foreach ($i as $key => $value) {
// If we try to find Foo module, look for ModuleFoo.class.php
$match = "Module{$class}.class.php";
if (substr($value, -strlen($match)) == $match) {
Log::log("ModuleLoader ; Found class {$class} in file \"{$value}\".", Log::INFO);
include_once $key;
break 1;
// exit foreach
} else {
Log::log("ModuleLoader ; Skipping file \"{$value}\".", Log::DEBUG);
}
}
return $class;
} else {
return false;
}
}
示例4: curlFetch
public static function curlFetch($url)
{
$numTries = 0;
do {
global $baseAddr;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Crest Fetcher for https://{$baseAddr}");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
//timeout in seconds
$body = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode == 200) {
return $body;
}
if ($httpCode == 403) {
return;
}
if ($httpCode == 500) {
return 500;
}
if ($httpCode == 415) {
return 415;
}
++$numTries;
sleep(1);
} while ($httpCode != 200 && $numTries <= 3);
Log::log("Gave up on {$url}");
return;
}
示例5: processAMFResponse
private function processAMFResponse($streamResponse, AsyncStreamSetInfo $asyncStreamSetInfo)
{
/*MessageDataReader*/
$parser = new MessageDataReader();
/*Message*/
$responseObject = $parser->readMessage($streamResponse);
/*Object[]*/
$responseData = $responseObject->getRequestBodyData();
/*V3Message*/
$v3 = $responseData[0]->defaultAdapt();
if ($v3->isError()) {
/*ErrMessage*/
$errorMessage = $v3;
/*Fault*/
$fault = new Fault($errorMessage->faultString, $errorMessage->faultDetail);
$asyncStreamSetInfo->responder->errorHandler($fault);
} else {
/*Object[]*/
$returnValue = $v3->body->body;
/*Object[]*/
$adaptedObject = array();
for ($i = 0; $i < count($returnValue); $i++) {
$adaptedObject[$i] = $returnValue[$i]->defaultAdapt();
}
var_dump($adaptedObject);
Log::log(LoggingConstants::MYDEBUG, ob_get_contents());
$asyncStreamSetInfo->responder->responseHandler($adaptedObject);
}
}
示例6: inspect
public function inspect($targetObject)
{
if (LOGGING) {
Log::log(LoggingConstants::DEBUG, "WebServiceHandler.inspect, targetObject: " . $targetObject);
}
if (strripos($targetObject, "wsdl") != strlen($targetObject) - 4) {
return null;
}
$proxyhost = '';
$proxyport = '';
$proxyusername = '';
$proxypassword = '';
$client = new soapclient($targetObject, true, $proxyhost, $proxyport, $proxyusername, $proxypassword);
$err = $client->getError();
if ($err) {
throw new Exception($err);
}
$proxy = $client->getProxy();
// $webInsp = new WebServiceInspector();
// $webInsp->inspect($targetObject);
//
// $serviceDescriptor = $webInsp->serviceDescriptor;
//// if( LOGGING )
//// Log::log( LoggingConstants::MYDEBUG, ob_get_contents());
// $_SESSION['wsdl'][$targetObject] = serialize($serviceDescriptor);
$proxyName = get_class($proxy);
$proxyReflection = new ReflectionClass($proxyName);
$serviceDescriptor = ClassInspector::inspectClass($proxyReflection);
if (LOGGING) {
Log::log(LoggingConstants::DEBUG, "web service handler has successfully inspected target service");
}
return $serviceDescriptor;
}
示例7: initConfigFromKabelDeutschland
/**
* calls main kd-config backend to retrieve user-specific vars
*/
protected function initConfigFromKabelDeutschland()
{
$url = $this->base_config['config_url'] . '?';
foreach ($this->base_config['params'] as $name => $value) {
$url .= urlencode($name) . '=' . urlencode($value) . '&';
}
$url = substr($url, 0, strlen($url) - 1);
$arr_config = $this->get($url, array(), true);
$this->base_url = $arr_config['params']['Gateways'][0]['JsonGW'];
// init obj has wrong format
$arr_init = $arr_config['params']['InitObj'];
foreach ($arr_init as $element) {
foreach ($element as $key => $value) {
if (!is_array($value)) {
$this->init_object['initObj'][$key] = $value;
} else {
foreach ($value as $sub_element) {
foreach ($sub_element as $sub_key => $sub_value) {
$this->init_object['initObj'][$key][$sub_key] = $sub_value;
}
}
}
}
}
// set hardcoded values
$this->init_object['initObj']['UDID'] = $this->api['udid'];
$this->obj_log->log('initConfig', json_encode($this->init_object));
}
示例8: execute
public function execute(Request $message)
{
/*String*/
$dsId = $this->headers["DSId"];
/*String*/
$woId = $this->headers["WebORBClientId"];
/*IDestination*/
$destObj = ORBConfig::getInstance()->getDataServices()->getDestinationManager()->getDestination($this->destination);
if ($destObj == null) {
/*String*/
$error = "Unknown destination - " . $destination . ". Make sure the destination is properly configured.";
if (LOGGING) {
Log::log(LoggingConstants::ERROR, $error);
}
return new ErrMessage($this->messageId, new Exception($error));
}
/*Object[]*/
$bodyParts = $this->body->body;
if ($bodyParts != null && count($bodyParts) > 0) {
for ($i = 0, $len = count($bodyParts); $i < $len; $i++) {
$this->body->body[$i] = $bodyParts[$i]->defaultAdapt();
}
$destObj->messagePublished($woId, $bodyParts[0]);
$destObj->getServiceHandler()->addMessage($this->headers, $this);
}
return new AckMessage($this->messageId, $this->clientId, null, array());
}
示例9: updateCorporations
private static function updateCorporations($db)
{
$db->execute("delete from zz_corporations where corporationID = 0");
$db->execute("insert ignore into zz_corporations (corporationID) select executorCorpID from zz_alliances where executorCorpID > 0");
$result = $db->query("select corporationID, name, memberCount, ticker from zz_corporations where lastUpdated < date_sub(now(), interval 1 week) and corporationID >= 1000001 order by lastUpdated limit 100", array(), 0);
foreach ($result as $row) {
$id = $row["corporationID"];
$pheal = Util::getPheal();
$pheal->scope = "corp";
try {
$corpInfo = $pheal->CorporationSheet(array("corporationID" => $id));
$name = $corpInfo->corporationName;
$ticker = $corpInfo->ticker;
$memberCount = $corpInfo->memberCount;
$ceoID = $corpInfo->ceoID;
if ($ceoID == 1) {
$ceoID = 0;
}
$dscr = $corpInfo->description;
//CLI::out("|g|$id|n| $name");
if ($name != "") {
$db->execute("update zz_corporations set name = :name, ticker = :ticker, memberCount = :memberCount, ceoID = :ceoID, description = :dscr, lastUpdated = now() where corporationID = :id", array(":id" => $id, ":name" => $name, ":ticker" => $ticker, ":memberCount" => $memberCount, ":ceoID" => $ceoID, ":dscr" => $dscr));
}
} catch (Exception $ex) {
$db->execute("update zz_corporations set lastUpdated = now(), name = :name where corporationID = :id", array(":id" => $id, ":name" => "Corporation {$id}"));
if ($ex->getCode() != 503) {
Log::log("ERROR Validating Corp {$id}: " . $ex->getMessage());
}
}
usleep(100000);
// Try not to spam the API servers (pauses 1/10th of a second)
}
}
示例10: dispatch
public function dispatch(Request &$request)
{
$config = ORBConfig::getInstance();
for ($i = 0, $max = $request->getBodyCount(); $i < $max; $i++) {
$request->setCurrentBody($i);
$requestURI = $request->getRequestURI();
if (LOGGING) {
Log::log(LoggingConstants::INFO, "requestURI = {$requestURI}");
}
$serviceId = substr($requestURI, 0, strrpos($requestURI, "."));
$methodName = substr($requestURI, strlen($serviceId) + 1);
$arg = $request->getRequestBodyData();
if (!is_array($arg)) {
$arg = array($request->getRequestBodyData());
}
try {
$value = self::handleInvoke($request, $serviceId, $methodName, $arg);
$namedObject = $arg[0];
$correlationId = $namedObject->defaultAdapt()->messageId;
$ackMessage = new AckMessage($correlationId, null, $value);
$request->setResponseBodyPart($ackMessage);
$request->setResponseURI("/onResult");
} catch (Exception $e) {
$request->setResponseBodyPart($e);
$request->setResponseURI("/onStatus");
}
}
return true;
}
示例11: save
static function save($type = '', $destination = '', $extra = '')
{
if (empty(self::$log)) {
return;
}
$type = $type ? $type : C('LOG_TYPE');
if (self::FILE == $type) {
// 文件方式记录日志信息
if (empty($destination)) {
$destination = C('LOG_PATH') . date('y_m_d') . '.log';
}
//检测日志文件大小,超过配置大小则备份日志文件重新生成
if (is_file($destination) && floor(C('LOG_FILE_SIZE')) <= filesize($destination)) {
rename($destination, dirname($destination) . '/' . time() . '-' . basename($destination));
}
} else {
$destination = $destination ? $destination : C('LOG_DEST');
$extra = $extra ? $extra : C('LOG_EXTRA');
}
$now = date(self::$format);
error_log($now . ' ' . get_client_ip() . ' ' . $_SERVER['REQUEST_URI'] . "\r\n" . implode('', self::$log) . "\r\n", $type, $destination, $extra);
// 保存后清空日志缓存
self::$log = array();
//clearstatcache();
}
示例12: dump
public static function dump($data, $label = '')
{
if (!self::hasDebug()) {
return;
}
Log::log(self::CLASSNAME, $data, $label);
}
示例13: dispatch
public function dispatch(Request &$request)
{
if (!$this->isV3Request($request)) {
return false;
}
$authError = false;
for ($i = 0, $max = $request->getBodyCount(); $i < $max; $i++) {
$request->setCurrentBody($i);
$array = $request->getRequestBodyData();
$class = new ReflectionClass("V3Message");
if ($array[0] instanceof NamedObject && $array[0]->canAdaptTo($class)) {
/*NamedObject*/
$namedObject = $array[0];
/*V3Message*/
$v3message = $namedObject->defaultAdapt();
$v3message = $v3message->execute($request);
$request->setResponseBodyPart($v3message);
if ($v3message->IsError()) {
$request->setResponseURI(ORBConstants::ONSTATUS);
} else {
$request->setResponseURI(ORBConstants::ONRESULT);
}
} else {
if (LOGGING) {
Log::log(LoggingConstants::DEBUG, "cannot be adapted to V3Message");
}
return false;
}
}
return true;
}
示例14: pass
public function pass()
{
$remoteHost = $this->getRemoteHostName();
if ($remoteHost == null) {
if (LOGGING) {
Log::log(LoggingConstants::ERROR, "unable to resolve the host name for " . Network::getUserHostAddress());
}
return false;
}
if ($this->m_isLocalHost) {
return $this->localHostCheck($remoteHost);
}
foreach ($this->m_comparators as $comparator) {
$needToBreak = false;
$index = strrpos($remoteHost, ".");
$token = $remoteHost;
if ($index === false) {
$needToBreak = true;
} else {
$token = substr($remoteHost, index + 1);
}
if (!$comparator->match($token)) {
return false;
}
if ($needToBreak) {
break;
}
$remoteHost = substr($remoteHost, 0, $index);
}
return true;
}
示例15: autolog
/**
* Automatik logging.
* Selects if to log as json string or as plain string depending if
* message is object or string.
* @param string $level
* @param mixed $message
*/
private static function autolog($level, $message)
{
if (is_string($message)) {
Log::log($level, $message);
} else {
Log::jlog($level, $message);
}
}