本文整理匯總了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;
}