本文整理汇总了PHP中logging函数的典型用法代码示例。如果您正苦于以下问题:PHP logging函数的具体用法?PHP logging怎么用?PHP logging使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logging函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($argError, $argCode = NULL, $argPrevius = NULL)
{
// 書き換える前のエラーをロギングしておく
logging($argError . PATH_SEPARATOR . var_export(debug_backtrace(), TRUE), 'exception');
debug($argError);
// 通常は500版のインターナルサーバエラー
$msg = 'Internal Server Error';
// RESTfulエラーコード&メッセージ定義
if (400 === $argCode) {
// バリデーションエラー等、必須パラメータの有無等の理由によるリクエスト自体の不正
$msg = 'Bad Request';
} elseif (401 === $argCode) {
// ユーザー認証の失敗
$msg = 'Unauthorized';
} elseif (404 === $argCode) {
// 許可されていない(もしくは未定義の)リソース(モデル)へのアクセス
$msg = 'Not Found';
} elseif (405 === $argCode) {
// 許可されていない(もしくは未定義の)リソースメソッドの実行
$msg = 'Method Not Allowed';
} elseif (503 === $argCode) {
// メンテナンスや制限ユーザー等の理由による一時利用の制限中
$msg = 'Service Unavailable';
}
parent::__construct($msg, $argCode, $argPrevius);
}
示例2: db_driver_connect
/**
* Connect to the database.
*
* @return void
*/
function db_driver_connect()
{
global $_db;
if ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_mysql') {
$dsn = 'mysql:dbname=' . $_db['resource'][$_db['target']]['config']['name'] . ';host=' . $_db['resource'][$_db['target']]['config']['host'] . ($_db['resource'][$_db['target']]['config']['port'] ? ';port=' . $_db['resource'][$_db['target']]['config']['port'] : '');
} elseif ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_pgsql') {
$dsn = 'pgsql:dbname=' . $_db['resource'][$_db['target']]['config']['name'] . ';host=' . $_db['resource'][$_db['target']]['config']['host'] . ($_db['resource'][$_db['target']]['config']['port'] ? ';port=' . $_db['resource'][$_db['target']]['config']['port'] : '');
} elseif ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_sqlite') {
$dsn = 'sqlite:' . $_db['resource'][$_db['target']]['config']['name'];
} elseif ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_sqlite2') {
$dsn = 'sqlite2:' . $_db['resource'][$_db['target']]['config']['name'];
}
if ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_mysql') {
$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true);
} elseif ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_pgsql' or $_db['resource'][$_db['target']]['config']['type'] === 'pdo_sqlite' or $_db['resource'][$_db['target']]['config']['type'] === 'pdo_sqlite2') {
$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT);
}
try {
$_db['resource'][$_db['target']]['dbh'] = new PDO($dsn, $_db['resource'][$_db['target']]['config']['username'], $_db['resource'][$_db['target']]['config']['password'], $options);
} catch (PDOException $e) {
if (LOGGING_MESSAGE) {
logging('message', 'db: Connect error');
}
error('db: Connect error');
}
return;
}
示例3: ctrl_login
function ctrl_login() {
global $cfg;
$cfg['in_admin'] = true;
$output['admin_title']='login';
if (logging(getPost('username'), getPost('password'))) {
redirect("admin/projects/");
} else {
output("login.html.php",$output);
}
}
示例4: db_driver_connect
/**
* Connect to the database.
*
* @return void
*/
function db_driver_connect()
{
global $_db;
$_db['resource'][$_db['target']]['dbh'] = sqlite_open($_db['resource'][$_db['target']]['config']['name'], 0666, $error);
if (!$_db['resource'][$_db['target']]['dbh']) {
if (LOGGING_MESSAGE) {
logging('message', 'db: Connect error');
}
error('db: Connect error');
}
return;
}
示例5: db_driver_connect
/**
* Connect to the database.
*
* @return void
*/
function db_driver_connect()
{
global $_db;
$_db['resource'][$_db['target']]['dbh'] = pg_connect('host=' . $_db['resource'][$_db['target']]['config']['host'] . ($_db['resource'][$_db['target']]['config']['port'] ? ' port=' . $_db['resource'][$_db['target']]['config']['port'] : '') . ' dbname=' . $_db['resource'][$_db['target']]['config']['name'] . ' user=' . $_db['resource'][$_db['target']]['config']['username'] . ' password=' . $_db['resource'][$_db['target']]['config']['password'], true);
if (!$_db['resource'][$_db['target']]['dbh']) {
if (LOGGING_MESSAGE) {
logging('message', 'db: Connect error');
}
error('db: Connect error');
}
return;
}
示例6: _clearCacheImage
/**
*/
protected static function _clearCacheImage($argFilePath, $argMemcacheDSN = NULL)
{
$DSN = NULL;
if (NULL === $argMemcacheDSN && class_exists('Configure') && NULL !== Configure::constant('MEMCACHE_DSN')) {
$DSN = Configure::MEMCACHE_DSN;
} else {
$DSN = $argMemcacheDSN;
}
if (NULL !== $DSN && class_exists('Memcache', FALSE)) {
try {
Memcached::start($DSN);
@Memcached::delete($argFilePath);
} catch (Exception $Exception) {
logging(__CLASS__ . PATH_SEPARATOR . __METHOD__ . PATH_SEPARATOR . __LINE__ . PATH_SEPARATOR . $Exception->getMessage(), 'exception');
}
}
return true;
}
示例7: addHandlers
public function addHandlers($hostPattern, $hostHandlers)
{
if ($hostPattern[0] != '^') {
$hostPattern = '/^' . $hostPattern;
}
if ($hostPattern[strlen($hostPattern) - 1] != '$') {
$hostPattern = $hostPattern . '$/';
}
$handlers = [];
foreach ($hostHandlers as $spec) {
if (in_array(count($spec), [2, 3, 4])) {
$name = null;
$kargs = [];
if (count($spec) == 2) {
list($pattern, $handler) = $spec;
} else {
if (count($spec) == 3) {
if (is_array($spec[2])) {
list($pattern, $handler, $kargs) = $spec;
} else {
list($pattern, $handler, $name) = $spec;
}
} else {
if (count($spec) == 4) {
list($pattern, $handler, $name, $kargs) = $spec;
}
}
}
$spec = new URLSpec($pattern, $handler, $name, $kargs);
$handlers[] = $spec;
if ($spec->name) {
if (array_key_exists($spec->name, $this->namedHandlers)) {
logging('Multiple handlers named ' . $spec->name . '; replacing previous value');
}
$this->namedHandlers[$spec->name] = $spec;
}
}
}
if (array_key_exists($hostPattern, $this->handlers)) {
$this->handlers[$hostPattern] = array_merge($handlers, $this->handlers[$hostPattern]);
} else {
$this->handlers[$hostPattern] = $handlers;
}
}
示例8: db_driver_connect
/**
* Connect to the database.
*
* @return void
*/
function db_driver_connect()
{
global $_db;
$_db['resource'][$_db['target']]['dbh'] = mysql_connect($_db['resource'][$_db['target']]['config']['host'] . ($_db['resource'][$_db['target']]['config']['port'] ? ':' . $_db['resource'][$_db['target']]['config']['port'] : ''), $_db['resource'][$_db['target']]['config']['username'], $_db['resource'][$_db['target']]['config']['password'], true);
if (!$_db['resource'][$_db['target']]['dbh']) {
if (LOGGING_MESSAGE) {
logging('message', 'db: Connect error');
}
error('db: Connect error');
}
$resource = mysql_select_db($_db['resource'][$_db['target']]['config']['name'], $_db['resource'][$_db['target']]['dbh']);
if (!$resource) {
if (LOGGING_MESSAGE) {
logging('message', 'db: Connect error');
}
error('db: Select DB error');
}
return;
}
示例9: pCell
function pCell($item, $var, $format, $size = "", $nohelp = "")
{
$var = stripslashes($var);
$out = tda(gTxt($item), ' style="text-align:right;vertical-align:middle"');
switch ($format) {
case "radio":
$in = yesnoradio($item, $var);
break;
case "input":
$in = text_input($item, $var, $size);
break;
case "timeoffset":
$in = timeoffset_select($item, $var);
break;
case 'commentmode':
$in = commentmode($item, $var);
break;
case 'cases':
$in = cases($item, $var);
break;
case 'dateformats':
$in = dateformats($item, $var);
break;
case 'weeks':
$in = weeks($item, $var);
break;
case 'logging':
$in = logging($item, $var);
break;
case 'languages':
$in = languages($item, $var);
break;
case 'text':
$in = text($item, $var);
break;
case 'urlmodes':
$in = urlmodes($item, $var);
}
$out .= td($in);
$out .= $nohelp != 1 ? tda(popHelp($item), ' style="vertical-align:middle"') : td();
return tr($out);
}
示例10: sendGoogleCloudMessage
function sendGoogleCloudMessage($data, $ids)
{
//echo "Push\n";
$apiKey = 'AIzaSyDOuSpNEoCGMB_5SXaA1Zj7Dtnzyyt6TPc';
$url = 'https://gcm-http.googleapis.com/gcm/send';
// Set GCM post variables (device IDs and push payload)
$post = array('registration_ids' => $ids, 'data' => $data);
// Set CURL request headers (authentication and type)
$headers = array('Authorization: key=' . $apiKey, 'Content-Type: application/json');
// Initialize curl handle
$ch = curl_init();
// Set URL to GCM endpoint
curl_setopt($ch, CURLOPT_URL, $url);
// Set request method to POST
curl_setopt($ch, CURLOPT_POST, true);
// Set our custom headers
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Get the response back as string instead of printing it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set JSON post data
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post));
// echo json_encode( $headers) . "\n";
logging("dataGCM", json_encode($post));
// echo "\n";
// Actually send the push
$result = curl_exec($ch);
// Error handling
if (curl_errno($ch)) {
//echo 'GCM error: ' . curl_error( $ch );
return 'GCM error: ' . curl_error($ch);
}
// Close curl handle
curl_close($ch);
// Debug GCM response
//echo $result;
return $result;
}
示例11: error
/**
* 报错
* @param unknown $err
*/
function error($err)
{
$log = "TIME:" . date('Y-m-d :H:i:s') . "\n";
$log .= "SQL:" . $err . "\n";
$log .= "REQUEST_URI:" . $_SERVER['REQUEST_URI'] . "\n";
$log .= "--------------------------------------\n";
logging(date('Ymd') . '-mysql-error.txt', $log);
}
示例12: generateConsumerTokens
/**
* @return the Consumer key (= app key)
*
*
*/
protected function generateConsumerTokens($appId, $uuid)
{
global $ilDB;
// creates a new database table for the registration if no one exists yet
logging(" check if our table is present already ");
if (!in_array("ui_uihk_xmob_reg", $ilDB->listTables())) {
logging("create a new table");
//create table that will store the app keys and any such info in the database
//ONLY CREATE IF THE TABLE DOES NOT EXIST
$fields = array("app_id" => array('type' => 'text', 'length' => 255), "uuid" => array('type' => 'text', 'length' => 255), "consumer_key" => array('type' => 'text', 'length' => 255), "consumer_secret" => array('type' => 'text', 'length' => 255));
$ilDB->createTable("isnlc_reg_info", $fields);
}
if (in_array("ui_uihk_xmob_reg", $ilDB->listTables())) {
//if for the specified app id and uuid an client key (= app key) already exists, use this one instead of creating a new one
$result = $ilDB->query("SELECT consumer_key FROM ui_uihk_xmob_reg WHERE uuid = " . $ilDB->quote($uuid, "text") . " AND app_id =" . $ilDB->quote($appId, "text"));
$fetch = $ilDB->fetchAssoc($result);
logging("fetch: " . json_encode($fetch));
$consumerKey = $fetch["consumer_key"];
$consumerSecret = $fetch["consumer_secret"];
//if no consumer
if ($consumerKey == null && $consumerSecret == null) {
$randomSeed = rand();
//$consumerKey = md5($uuid . $appId . $randomSeed);
// generate consumer key and consumer secret
$hash = sha1(mt_rand());
$consumerKey = substr($hash, 0, 30);
$consumerSecret = substr($hash, 30, 10);
//store the new client key (= app key) in the database
$affected_rows = $ilDB->manipulateF("INSERT INTO ui_uihk_xmob_reg (app_id, uuid, consumer_key, consumer_secret) VALUES " . " (%s,%s,%s)", array("text", "text", "text", "text"), array($appId, $uuid, $consumerKey, $consumerSecret));
// if this fails we must not return the app key
logging("return consumer tokens " . $consumerKey . " and " . $consumerSecret);
}
}
//return the consumerKey and consumerSecret in an array
$data = array("consumerKey" => $consumerKey, "consumerSecret" => $consumerSecret);
return $data;
}
示例13: died
died("Could NOT copy the file!");
}
suppr("{$bazar_dir}/{$pic_path}/{$_picture}");
}
}
}
}
if ($picture_del) {
$picture = "";
$_picture = "";
}
// Database Update
$query = mysql_query("update " . $prefix . "userdata\n\t\t\t\t\t\t set sex = '{$_POST['sex']}',\n\t\t\t\t newsletter = '{$_POST['newsletter']}',\n\t\t\t\t\t\t firstname = '{$_POST['firstname']}',\n\t\t\t\t\t\t lastname = '{$_POST['lastname']}',\n\t\t\t\t\t\t address = '{$_POST['address']}',\n\t\t\t\t\t\t zip = '{$_POST['zip']}',\n\t\t\t\t\t\t city = '{$_POST['city']}',\n\t\t\t\t\t\t state = '{$_POST['state']}',\n\t\t\t\t\t\t country = '{$_POST['country']}',\n\t\t\t\t\t\t phone = '{$_POST['phone']}',\n\t\t\t\t\t\t cellphone = '{$_POST['cellphone']}',\n\t\t\t\t\t\t icq = '{$_POST['icq']}',\n\t\t\t\t\t\t homepage = '{$_POST['homepage']}',\n\t\t\t\t\t\t hobbys = '{$_POST['hobbys']}',\n picture= '{$picture}',\n _picture= '{$_picture}',\n\t\t\t\t\t\t field1 = '{$_POST['field1']}',\n\t\t\t\t\t\t field2 = '{$_POST['field2']}',\n\t\t\t\t\t\t field3 = '{$_POST['field3']}',\n\t\t\t\t\t\t field4 = '{$_POST['field4']}',\n\t\t\t\t\t\t field5 = '{$_POST['field5']}',\n\t\t\t\t\t\t field6 = '{$_POST['field6']}',\n\t\t\t\t\t\t field7 = '{$_POST['field7']}',\n\t\t\t\t\t\t field8 = '{$_POST['field8']}',\n\t\t\t\t\t\t field9 = '{$_POST['field9']}',\n\t\t\t\t\t\t field10 = '{$_POST['field10']}',\n\t\t\t\t\t\t timezone = '{$_POST['timezone']}',\n\t\t\t\t\t\t dateformat = '{$_POST['dateformat']}'\n\t\t\t where id = '{$_SESSION['suserid']}'") or died(mysql_error());
$_SESSION[susertimezone] = $_POST[timezone];
$_SESSION[suserdateformat] = $_POST[dateformat];
logging("X", "{$_SESSION['suserid']}", "{$_SESSION['susername']}", "AUTH: updated data", "");
if (!$query) {
$m_update = $error[20];
} else {
$m_update = 2;
}
}
if ($m_update != 2) {
died($m_update);
# $errormessage=rawurlencode($m_update);
# header(headerstr("members.php?choice=myprofile&status=6&errormessage=$errormessage"));
exit;
} else {
header(headerstr("members.php?choice=myprofile&status=5"));
exit;
}
示例14: header
header('Accept: application/json');
include_once 'config.php';
include_once 'logging.php';
include_once 'commands.php';
include_once 'tools.php';
include_once 'api.php';
// Get Telegram Hooks POST Data
$json = file_get_contents('php://input') . PHP_EOL;
$data = json_decode($json, true);
// Logging Hooks Data Raw
$time = date('Y-m-d H:i:s', time());
logging("hooks_raw", "<" . $time . ">" . PHP_EOL);
logging("hooks_raw", $json);
// Logging Hooks Data Array
logging("hooks", "<" . $time . ">" . PHP_EOL);
logging("hooks", $data);
// Global Variable
$updateID = $data['update_id'];
$messageID = $data['message']['message_id'];
$fromID = $data['message']['from']['id'];
$chatID = $data['message']['chat']['id'];
$date = $data['message']['date'];
$userName = $data['message']['from']['username'];
$message = $data['message']['text'];
if ($userName != "") {
if ($chatID == -6205296) {
$db = new SQLite3('bot.db');
$db->exec("CREATE TABLE IF NOT EXISTS `CPRTeam_STAFF` (\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `uid` TEXT NOT NULL,\n `username` TEXT\n )");
$query = $db->query("SELECT * FROM CPRTeam_STAFF WHERE uid = '{$fromID}'");
$i = 0;
$row = array();
示例15: logging
// echo $result . "\n";
logging("ResultCompare", json_encode($_GET));
//Log file
$pathOfLog = "C:/data/log/";
$t = time();
$logName = 'CompareLog-' . date("Y-m-d", $t) . '.txt';
$logText = date("Y-m-d", $t) . '-' . date("h:i:sa") . " " . json_encode($_GET) . PHP_EOL;
file_put_contents($pathOfLog . $logName, $logText, FILE_APPEND);
if (strcmp($result, "") != 0) {
if (strcmp($mode, "NoticeFindClue") == 0) {
$notice_id = $input;
$clue_id = $result;
$clue_list = explode(",", $clue_id);
for ($i = 0; $i < sizeof($notice_list); $i++) {
logging("ResultGCM", prepareNotificationOneClueOneNotice($clue_list[$i], $notice_id));
}
} else {
if (strcmp($mode, "ClueFindNotice") == 0) {
$clue_id = $input;
$notice_id = $result;
logging("ResultGCM", prepareNotificationOneClueManyNotice($clue_id, $notice_id));
} else {
if (strcmp($mode, "DirectClueToNotice") == 0) {
$clue_id = $input;
$notice_id = $result;
logging("ResultGCM", prepareNotificationOneClueOneNotice($clue_id, $notice_id));
}
}
}
}
exit;