本文整理汇总了PHP中XWB_plugin::LOG方法的典型用法代码示例。如果您正苦于以下问题:PHP XWB_plugin::LOG方法的具体用法?PHP XWB_plugin::LOG怎么用?PHP XWB_plugin::LOG使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XWB_plugin
的用法示例。
在下文中一共展示了XWB_plugin::LOG方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _LogHelper
function _LogHelper($apiRoute)
{
if (!defined('XWB_LOCAL_API_LOG') || XWB_LOCAL_API_LOG != TRUE) {
return;
}
$data = array("\r\n" . str_repeat('-', 45), "[REQUEST_URI]:\t\t" . ($_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : '_UNKNOWN_'), "[API_ROUTE]:\t\t" . $apiRoute, "[ERROR_NO]:\t\t" . $this->errno, "[ERROR_MSG]:\t\t" . ($this->err ? $this->err : '_EMPTY_'), "[API_RESULT]:\t\t" . ($this->rst && !is_bool($this->rst) ? "\r\n" . print_r($this->rst, TRUE) : (is_bool($this->rst) ? $this->rst ? 'TRUE' : 'false' : '_EMPTY_')), str_repeat('-', 45) . "\r\n\r\n");
$logFile = XWB_P_DATA . '/api/api_local_log_' . date("Y-m-d_H") . '.txt';
XWB_plugin::LOG(implode("\r\n", $data), $logFile);
return;
}
示例2: logRespond
/**
* 将respond给log下来,以作为OAUTH DEBUG证据
* 需要定义XWB_DEV_LOG_ALL_RESPOND并且设置为true,才记录
*
* @param string $url 完整调用OATUH的URL
* @param string $method 调用方法
* @param integer $respondCode 返回状态代号
* @param mixed $respondResult 返回结果
* @param mixed $extraMsg 额外需要记录的内容
*/
function logRespond($url, $method, $respondCode, $respondResult = array(), $extraMsg = array())
{
//调用这个类的当前页面的url
$callURL = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '__UNKNOWN__';
//oauth url简略提取,以用作统计
$oauth_short_url = str_replace(XWB_API_URL_20, '', strpos($url, '?') !== false ? substr($url, 0, strpos($url, '?')) : $url);
if ($respondCode == 0) {
//timeout
$respondResult = '__CONNECTION MAYBE TIME OUT ?__';
} elseif ($respondCode == -1) {
$respondResult = '__CAN NOT CONNECT TO API SERVER; OR CREATE A WRONG OAUTH REQUEST URL. PLEASE INSPECT THE LOG__';
}
if (empty($respondResult)) {
$respondResult = '__NO RESPOND RESULT__';
}
//extraMsg数组中,triggered_error是用于存放fsockopenHttp的trigger_error信息
if (isset($extraMsg['triggered_error']) && empty($extraMsg['triggered_error'])) {
unset($extraMsg['triggered_error']);
}
if (isset($extraMsg['key_string'])) {
$extraMsg['key_string'] = strtr($extraMsg['key_string'], array(XWB_APP_SECRET_KEY => '%APP_SKEY%'));
}
$time_process = isset($extraMsg['time_process']) ? round((double) $extraMsg['time_process'], 6) : 0;
unset($extraMsg['time_process']);
$error_count_log = '';
if ($this->req_error_count > 0) {
$error_count_log = '[REQUEST ERROR COUNT IN THIS PHP LIFETIME] ' . $this->req_error_count . "\r\n";
}
$msg = $method . "\t" . $respondCode . "\t" . $time_process . " sec.\t" . $oauth_short_url . "\t" . "\r\n" . str_repeat('-', 5) . '[EXTRA MESSAGE START]' . str_repeat('-', 5) . "\r\n" . $error_count_log . '[CALL URL]' . $callURL . "\r\n" . '[OAUTH REQUEST URL]' . $url . "\r\n" . '[RESPOND RESULT]' . "\r\n" . print_r($respondResult, 1) . "\r\n\r\n" . '[EXTRA LOG MESSAGE]' . "\r\n" . print_r($extraMsg, 1) . "\r\n" . str_repeat('-', 5) . '[EXTRA MESSAGE END]' . str_repeat('-', 5) . "\r\n\r\n\r\n";
$logFile = XWB_P_DATA . '/oauth_respond_log_' . date("Y-m-d_H") . '.txt.php';
XWB_plugin::LOG($msg, $logFile);
return 1;
}
示例3: statUrl
/**
* 生成统计上报url(当$html参数为true时,可使用返回的内容,通过客户端进行上报)
* @param string $type stat类型
* @param array $args stat参数
* @param bool 生成html?默认为否
* @param bool 是否产生random?默认为是
* @return string
*/
function statUrl($type, $args = array(), $html = false, $random = true)
{
if (defined('XWB_P_STAT_DISABLE')) {
return '';
}
$statUrl = 'http://beacon.x.weibo.com/a.gif';
//stat参数公用部分添加
$args['pjt'] = XWB_P_PROJECT;
$args['dsz'] = XWB_S_VERSION;
$args['ver'] = XWB_P_VERSION;
$args['xt'] = $type;
$args['akey'] = isset($args['akey']) ? $args['akey'] : XWB_APP_KEY;
$args['ip'] = XWB_plugin::getIP();
//新浪用户uid,最好强制传值,否则会异步计算错误
if (!isset($args['uid'])) {
$args['uid'] = XWB_plugin::getBindInfo("sina_uid");
}
$args['uid'] = !is_numeric($args['uid']) || 1 > $args['uid'] ? '' : $args['uid'];
if (true === $random) {
$args['random'] = rand(1, 999999);
}
$statUrl .= '?' . http_build_query($args);
if (defined('XWB_P_DEBUG') && true == XWB_P_DEBUG) {
$logmsg = "上报的URL为:" . $statUrl;
XWB_plugin::LOG($logmsg, 'statRecord', false);
}
if (false == $html) {
return $statUrl;
} else {
return '<img src="' . $statUrl . '" style="display:none" />';
}
}
示例4: _logFaceSyncResult
/**
* 对同步头像结果进行DEBUG 日志记录,并返回文字log
* @param integer 返回的代码
* @return string 代码对应的文字
*/
function _logFaceSyncResult($code)
{
$tips = array('0' => '头像成功同步', '-1' => '初始化失败(无法获取新浪用户信息)', '-2' => '传uid参数错误(小于1)', '-3' => '无法获取服务器上的头像', '-4' => '服务器返回错误数据(非头像数据或者给出来的头像太小);或者临时目录权限问题导致无大头像文件', '-5' => '服务器没有加载GD库,无法进行头像同步操作', '-10' => '本地编码失败(一般是无法生成3种头像文件所致)', '-11' => '与UC进行HTTP通讯出错', '-12' => 'UC返回头像编码解码失败代码', '-13' => 'UC返回头像上传失败代码', '-14' => 'UC返回找寻传参uid失败代码', '-15' => 'UC返回未知错误代码', '-20' => '要复制的中等头像不存在', '-21' => XWB_S_TITLE . ' 设置不允许该用户所在用户组上传头像', '-22' => '复制头像到 ' . XWB_S_TITLE . ' 头像目录失败');
$faceSyncResultLog = isset($tips[$code]) ? $tips[$code] : '未知错误代码';
if (defined('XWB_DEV_LOG_ALL_RESPOND') && XWB_DEV_LOG_ALL_RESPOND == true) {
XWB_plugin::LOG("[FACE SYNC RESULT]\t{$code}\t{$faceSyncResultLog}");
}
return $faceSyncResultLog;
}
示例5: logRespond
/**
* 记录远程API调用
* 需要定义XWB_API_REMOTE_LOG并且设置为true,才记录
*
* @param string $url 完整调用OATUH的URL
* @param string $method 调用方法
* @param integer $code 返回状态代号
* @param mixed $result 返回结果
* @param mixed $extraMsg 额外需要记录的内容
*/
function logRespond($url, $method, $code, $result = array(), $extraMsg = array())
{
if (!defined('XWB_REMOTE_API_LOG') || XWB_REMOTE_API_LOG != true) {
return;
}
//调用这个类的当前页面的url
$callURL = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '__UNKNOWN__';
if ($code == 0) {
//timeout
$result = '__CONNECTION MAYBE TIME OUT ?__';
} elseif ($code == -1) {
$result = '__CAN NOT CONNECT TO API SERVER; OR CREATE A WRONG OAUTH REQUEST URL. PLEASE INSPECT THE LOG__';
}
if (empty($result)) {
$result = '__NO RESPOND RESULT__';
}
//extraMsg数组中,triggered_error是用于存放fsockopenHttp的trigger_error信息
if (isset($extraMsg['triggered_error']) && empty($extraMsg['triggered_error'])) {
unset($extraMsg['triggered_error']);
}
$time_process = isset($extraMsg['time_process']) ? round((double) $extraMsg['time_process'], 6) : 0;
unset($extraMsg['time_process']);
$data = array("\r\n" . str_repeat('-', 45), "[METHOD]:\t\t" . $method, "[RESPOND_CODE]:\t\t" . $code, "[TIME_PORCESS]:\t\t" . $time_process . ' sec', "[CALL URL]:\t\t" . $callURL, "[REQUEST URL]:\t\t" . $url, "[RESPOND RESULT]:\t\t" . ($result && !is_bool($result) ? "\r\n" . print_r($result, TRUE) : (is_bool($result) ? $result ? 'TRUE' : 'false' : '_EMPTY_')), "[EXTRA LOG MESSAGE]:\t\t" . ($extraMsg ? "\r\n" . print_r($extraMsg, TRUE) : '_EMPTY_'), str_repeat('-', 45) . "\r\n\r\n");
$logFile = XWB_P_DATA . '/api/api_remote_log_' . date("Y-m-d_H") . '.txt';
XWB_plugin::LOG(implode("\r\n", $data), $logFile);
return;
}
示例6: _logRespond
/**
* 记录与评论回推服务器进行的通讯
* @access protected
* @param array $extraMsg
*/
function _logRespond($extraMsg = array())
{
if (!defined('XWB_DEV_LOG_ALL_RESPOND') || XWB_DEV_LOG_ALL_RESPOND != true) {
return 0;
}
//调用这个类的当前页面的url
$callURL = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '__UNKNOWN__';
if ($this->httpcode == 0) {
//timeout
$respondResult = '__CONNECTION MAYBE TIME OUT ?__';
} elseif ($this->httpcode == -1) {
$respondResult = '__CAN NOT CONNECT TO PUSH BACK SERVER; OR CREATE A WRONG PUSH BACK REQUEST URL. PLEASE INSPECT THE LOG__';
} else {
$respondResult = $this->result;
}
if (empty($extraMsg['triggered_error'])) {
unset($extraMsg['triggered_error']);
}
$msg = $this->method . "\t" . $this->httpcode . "\t" . $this->requrl . "\t" . "\r\n" . str_repeat('-', 5) . '[EXTRA MESSAGE START]' . str_repeat('-', 5) . "\r\n" . '[CALL URL]' . $callURL . "\r\n" . '[RESPOND RESULT]' . "\r\n" . print_r($respondResult, 1) . "\r\n\r\n" . '[EXTRA LOG MESSAGE]' . "\r\n" . print_r($extraMsg, 1) . "\r\n" . str_repeat('-', 5) . '[EXTRA MESSAGE END]' . str_repeat('-', 5) . "\r\n\r\n\r\n";
$logFile = XWB_P_DATA . '/pushback_respond_' . date("Y-m-d_H") . '.txt.php';
XWB_plugin::LOG($msg, $logFile);
return 1;
}
示例7: _getOAuthUrl
function _getOAuthUrl()
{
static $aurl = null;
if (!empty($aurl)) {
return $aurl;
}
$sess = XWB_plugin::getUser();
$sess->clearToken();
$wbApi = XWB_plugin::getWB();
$keys = $wbApi->getRequestToken();
if (!isset($keys['oauth_token']) || !isset($keys['oauth_token_secret'])) {
$api_error_origin = isset($keys['error']) ? $keys['error'] : 'UNKNOWN ERROR. MAYBE SERVER CAN NOT CONNECT TO SINA API SERVER';
$api_error = isset($keys['error_CN']) && !empty($keys['error_CN']) && 'null' != $keys['error_CN'] ? $keys['error_CN'] : '';
XWB_plugin::LOG("[WEIBO CLASS]\t[ERROR]\t#{$wbApi->req_error_count}\t{$api_error}\t{$wbApi->last_req_url}\tERROR ARRAY:\r\n" . print_r($keys, 1));
XWB_plugin::showError("服务器获取Request Token失败;请稍候再试。<br />错误原因:{$api_error}[{$api_error_origin}]");
}
//print_r($keys);
$aurl = $wbApi->getAuthorizeURL($keys['oauth_token'], false, XWB_plugin::getEntryURL('xwbAuth.authCallBack'));
$sess->setOAuthKey($keys, false);
return rtrim($aurl, '&');
}
示例8: _log
/**
* log记录
* @param string $message
*/
function _log($message)
{
if (!defined('XWB_DEV_LOG_ALL_RESPOND') || XWB_DEV_LOG_ALL_RESPOND != true) {
return false;
}
XWB_plugin::LOG("[PUSHBACK LOG]\t{$message}");
return true;
}