本文整理汇总了PHP中Logs::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Logs::debug方法的具体用法?PHP Logs::debug怎么用?PHP Logs::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logs
的用法示例。
在下文中一共展示了Logs::debug方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: appException
/**
* 自定义异常处理
* @access public
* @param mixed $e 异常对象
*/
public static function appException($e)
{
$error = array();
$error['message'] = $e->getMessage();
$trace = $e->getTrace();
if ('E' == $trace[0]['function']) {
$error['file'] = $trace[0]['file'];
$error['line'] = $trace[0]['line'];
} else {
$error['file'] = $e->getFile();
$error['line'] = $e->getLine();
}
$error['trace'] = $e->getTraceAsString();
Logs::debug("appException", $error);
}
示例2: errorlog
private function errorlog($msg = '')
{
$error = date('Y-m-d H:i:s') . ":\n" . $this->errorno() . ":\nmsg:" . $this->error() . $msg . ";\n";
Logs::debug('mysql.txt', $error);
/*
$file = APP_LOG_PATH . 'sql/mysql.txt';
file_put_contents($file, "{$error}\n", @filesize($file)<1024*1024 ? FILE_APPEND : null);
*/
die('DB Invalid!!!');
}
示例3: getConversionRules
public static function getConversionRules($className)
{
$className = strtolower($className);
if (!array_key_exists($className, self::$conversions)) {
Logs::debug('Registered models:', array_keys(self::$conversions));
throw new Exception('Unregistered model:' . $className);
}
return self::$conversions[$className];
}
示例4: executeRequest
private function executeRequest($httpMethod, $url, $queryParams = null, $requestHeaders = null, $contentType = "application/x-www-form-urlencoded", $specialAuth = null)
{
if ($queryParams == null) {
$queryParams = array();
}
if ($requestHeaders == null) {
$requestHeaders = array();
}
// Check if the charset is specified in the content-type:
if (strpos($contentType, 'charset') === false) {
$charset = OneApiConfigurator::getCharset();
if (!$charset) {
$charset = 'utf-8';
}
$contentType .= '; charset=' . $charset;
}
$sendHeaders = array('Content-Type: ' . $contentType);
foreach ($requestHeaders as $key => $value) {
$sendHeaders[] = $key . ': ' . $value;
}
if ($httpMethod === 'GET') {
if (sizeof($queryParams) > 0) {
$url .= '?' . $this->buildQuery($queryParams);
}
}
$opts = array(CURLOPT_FRESH_CONNECT => 1, CURLOPT_CONNECTTIMEOUT => 60, CURLOPT_TIMEOUT => 120, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 3, CURLOPT_USERAGENT => 'OneApi-php-' . self::VERSION, CURLOPT_CUSTOMREQUEST => $httpMethod, CURLOPT_URL => $url, CURLOPT_HTTPHEADER => $sendHeaders);
if ($specialAuth) {
$opts[CURLOPT_HTTPHEADER][] = 'Authorization: App ' . $specialAuth;
} else {
if ($this->oneApiAuthentication && $this->oneApiAuthentication->ibssoToken) {
// Token based authentication (one request per login request):
$opts[CURLOPT_HTTPHEADER][] = 'Authorization: IBSSO ' . $this->oneApiAuthentication->ibssoToken;
} else {
// Basic authorization:
$opts[CURLOPT_USERPWD] = $this->username . ':' . $this->password;
}
}
Logs::debug('Executing ', $httpMethod, ' to ', $url);
if (sizeof($queryParams) > 0 && ($httpMethod == 'POST' || $httpMethod == 'PUT')) {
$httpBody = null;
if (strpos($contentType, 'x-www-form-urlencoded')) {
$httpBody = $this->buildQuery($queryParams);
} else {
if (strpos($contentType, 'json')) {
$httpBody = json_encode($queryParams);
}
}
Logs::debug('Http body:', $httpBody);
$opts[CURLOPT_POSTFIELDS] = $httpBody;
}
$ch = curl_init();
curl_setopt_array($ch, $opts);
$result = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch) != 0) {
throw new Exception(curl_error($ch));
}
$isSuccess = 200 <= $code && $code < 300;
curl_close($ch);
Logs::debug('Response code ', $code);
Logs::debug('isSuccess:', $isSuccess);
Logs::debug('Result:', $result);
return array($isSuccess, $result);
}