本文整理汇总了PHP中Log::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::add方法的具体用法?PHP Log::add怎么用?PHP Log::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* PAGE: index
* This method handles what happens when you move to http://yourproject/home/index (which is the default page btw)
*/
public function index()
{
$redirected = false;
//check if there is an error
if ($_GET['error'] != '') {
//load error page!
die("<h1>Whoops, something went wrong, you can refresh to see if it fixes it otherwise check back later.</h1>");
}
if (isset($_GET['appSource'])) {
$redirected = true;
$appSource = (int) $_GET['appSource'];
}
if (!$redirected) {
if (isset($_GET['id']) && $_GET['id'] != "") {
$extraParameters['id'] = $_GET['id'];
}
if (isset($_GET['fbSource'])) {
$extraParameters['appSource'] = $_GET['appSource'];
}
if (isset($_GET['traffic_source']) && $_GET['traffic_source'] != '') {
$extraParameters['traffic_source'] = $_GET['traffic_source'];
}
}
$signedRequest = null;
if (isset($_POST['signed_request'])) {
$signedRequest = self::parseSignedRequest($_POST['signed_request']);
}
Log::add('Signed request: ' . $signedRequest);
//check if user_id
if ($signedRequest === null) {
//we need to get one!
$url = Config::get('facebook.appurl') . "?" . http_build_query($_GET);
header("location: " . $url);
exit;
}
if (!isset($signedRequest['user_id']) || $signedRequest['user_id'] == '') {
$redirectUrl = self::buildUrl($extraParameters);
$oAuthUrl = "https://www.facebook.com/dialog/oauth?";
$oAuthUrl .= http_build_query(array_filter(array('client_id' => Config::Get('facebook.appid'), 'redirect_uri' => self::buildUrl($extraParameters), 'scope' => 'user_friends,email')));
die("<script>top.location.href = '" . $oAuthUrl . "';</script>");
}
$fbCurlReq = new Curl();
$fbCurlReq->setOpt(CURLOPT_SSL_VERIFYPEER, false);
$fbCurlReq->get('https://graph.facebook.com/me?access_token=' . $signedRequest['oauth_token']);
if ($fbCurlReq->error) {
Log::add('Error fb user profile ' . $fbCurlReq->error_code . ': ' . $fbCurlReq->error_message);
} else {
$dataArray = $fbCurlReq->response;
}
Log::add('dataArray = ' . print_r($dataArray, true));
//check too see if this is a post :)
$game = new Game();
$game->loadGame((array) $dataArray, 'facebook', $extraParameters);
}
示例2: add
public static function add($type, $message, $sender = NULL)
{
if (is_null(self::$default_log)) {
self::$default_log = new Logger_Blackhole();
}
if (!in_array($sender, Kohana::$config->load('logger')->ignored_senders)) {
self::$default_log->add($type, $message, $sender);
}
}
示例3: index
public function index()
{
$this->_postLog->add('run', 'succ');
for ($i = 0; $i < 100; $i++) {
$this->_postLog->add('test', array("aaaasdsadsdasda", "adasdasdsadsa", "1213623213", "3213213"));
}
$this->_postLog->add('test', array("aaaasdsadsdasada", "adasdasdasadsa", "12136232a13", "321a3213"));
echo 'aa';
}
示例4: log
/**
* Logs with an arbitrary level.
*
* @param string $level a PSR LogLevel constant
* @param string $message
* @param array $context
*
* @return null
*/
public function log($level, $message, array $context = array())
{
$level = $this->convert_psr_to_kohana_level($level);
if ($exception = $this->get_exception_from_context($context)) {
$message .= \PHP_EOL . \Kohana_Exception::text($exception);
} elseif ($message instanceof \Exception) {
$context['exception'] = $message;
$message = \Kohana_Exception::text($message);
}
$this->log->add($level, $message, array(), $context);
}
示例5: getprice
public function getprice()
{
//we are going to get the item and return the required data to facebook.
if (!$_POST['signed_request']) {
Log::add('Signed request missing');
}
$req = Util::parseSignedRequest($_POST['signed_request']);
$payment = $req['payment'];
$product = $payment['product'];
$quantity = $payment['quantity'];
$currency = $payment['user_currency'];
$requestID = $payment['request_id'];
$method = $_POST['method'];
$user = $req['user'];
$country = $user['country'];
$locale = $user['locale'];
$age = $user['age']['min'];
$facebookUserID = $req['user_id'];
$itemID = substr(strrchr($product, '/'), 1);
if (!$itemID) {
Log::add('itemID was not found');
}
$storeModel = new StoreModel();
$item = $storeModel->getItem($itemID);
$return['content'] = array('product' => $product, 'amount' => $item->price / 100 * $quantity, 'currency' => $currency);
$return['method'] = $method;
$this->printJson($return);
}
示例6: lives
public function lives($playerID)
{
//we'll have a payload will have the hash key.
Validate::player($playerID);
Validate::payload($_POST['payload']);
//so we passed the inital validation
if ($_POST['payload'] == 'true') {
$_POST['payload'] = Util::hashPost($_POST);
}
if (!$_POST) {
throw new NInjaException("Error in request");
}
if (!$_POST['payload']) {
throw new NinjaException("No data was received");
}
$data = str_replace(' ', '+', $_POST['payload']);
$playerModel = new PlayerModel();
if ($ack = $playerModel->collectGifts($playerID, $data)) {
$response['status'] = 'ok';
$response['value'] = $ack['lives'];
$response['requests'] = $ack['requestCount'];
$response['remaining'] = 0;
//since we cap the # they can request to max lives of 8.
} else {
$response['status'] = 'error';
$response['message'] = "error saving data";
Log::add('Error updating lives');
}
$this->printJson($response);
}
示例7: __construct
public function __construct($message, $code)
{
Log::add($message . 'URI: ' . $_SERVER['REQUEST_URI'], $code);
if (!DEV) {
switch ($code) {
case 500:
Fw_Request::setGet('hard_controller', 'err');
Fw_Request::setGet('hard_action', 'error' . $code);
$error_app = new Application();
$error_app->run();
die;
break;
case 404:
default:
Fw_Request::setGet('hard_controller', 'err');
Fw_Request::setGet('hard_action', 'error' . $code);
$error_app = new Application();
$error_app->run();
die;
break;
}
}
$code = 0;
parent::__construct($message);
}
示例8: deleteRequests
public function deleteRequests($requests = array())
{
if (is_array($requests) && count($requests)) {
Log::add('deleteRequests .. requests was array and has some.. the data was: ' . print_r($requests, true));
$this->db->query('DELETE FROM player_gifts WHERE request_id IN ( ' . implode(',', $requests) . ') AND type = 2');
} else {
Log::add('Either requests was empty: ' . print_r($requests, true) . ' or it didnt have any: ' . count($requests));
}
}
示例9: loadClass
public function loadClass($class_name)
{
if (file_exists(CLASS_PATH . $class_name . '.php')) {
require CLASS_PATH . $class_name . '.php';
return new $class_name();
} else {
Log::add("Errror loading class: " . $class_name . " - " . CLASS_PATH . $class_name . '.php');
}
}
示例10: confirm_query
private function confirm_query($query = "")
{
if (!$query) {
$output = "Database Query Failed : " . mysqli_error($this->connection) . "\n";
$output .= "\nLast Sql Query: " . $this->last_query . " Time: " . Database::date();
Log::add($output, LOG_DB);
die($output);
return false;
}
}
示例11: checkAssetUpdate
public function checkAssetUpdate()
{
$this->db->select('asset_update_date');
$this->db->from('game_settings');
$this->db->where('id', 1);
$query = $this->db->get();
$row = $query->row();
Log::add('Checking asset last update ' . $row->asset_update_date);
return $row->asset_update_date;
}
示例12: get
public function get($index)
{
$temp = $this->memcache->get($index);
if ($temp == array()) {
//[DEBUG]
if (defined('LOGX_DEBUG')) {
Log::add('[' . __FILE__ . '] [' . __LINE__ . '] ' . L('_USE_ILLEGAL_INDEX_') . ' ' . $index, E_USER_NOTICE);
}
//[/DEBUG]
return NULL;
}
return $temp;
}
示例13: curl_init
function &request($url, $timeout = 5)
{
$ch = curl_init();
curl_setopt_array($ch, array(CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_URL => $url, CURLOPT_HEADER => TRUE, CURLOPT_AUTOREFERER => TRUE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_MAXREDIRS => 10, CURLOPT_CONNECTTIMEOUT => $timeout, CURLOPT_TIMEOUT => $timeout, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_FRESH_CONNECT => TRUE, CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'] ?: 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)', CURLOPT_REFERER => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']));
if ($this->_cookie_file) {
curl_setopt_array($ch, array(CURLOPT_COOKIEFILE => $this->_cookie_file, CURLOPT_COOKIEJAR => $this->_cookie_file));
}
if ($this->_proxy) {
curl_setopt_array($ch, array(CURLOPT_HTTPPROXYTUNNEL => TRUE, CURLOPT_PROXY => $this->_proxy, CURLOPT_PROXYTYPE => $this->_proxy_type));
}
if ($this->_header) {
$curl_header = array();
foreach ($this->_header as $k => $v) {
$curl_header[] = $k . ': ' . $v;
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_header);
}
if ($this->_post) {
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->_post));
}
$data = curl_exec($ch);
$this->clean();
$errno = curl_errno($ch);
if ($errno || !$data) {
$err = curl_error($ch);
Log::add("CURL ERROR({$errno} {$err}): {$url} ", 'error');
curl_close($ch);
return NULL;
}
$info = curl_getinfo($ch);
curl_close($ch);
$response = (object) [];
$response->header = [];
$response->body = NULL;
$response->error = FALSE;
list($header, $body) = explode("\n\n", str_replace("\r", "", $data), 2);
$response = new HTTP_Response();
$response->body = trim($body);
$header = explode("\n", $header);
$status = array_shift($header);
$response->status = $info['http_code'];
foreach ($header as $h) {
list($k, $v) = explode(': ', $h, 2);
if ($k) {
$response->header[$k] = $v;
}
}
return $response;
}
示例14: delete
public function delete()
{
$url = Registry::getUrl();
$id = $_REQUEST["id"] ? $_REQUEST["id"] : $url->vars[0];
$mosca = new Mosca($id);
if ($mosca->id) {
if ($mosca->delete()) {
Registry::addMessage("Mosca eliminada satisfactoriamente", "success");
//Log
Log::add(LOG_DELETE_MOSCA, $mosca);
}
}
Url::redirect(Url::site("moscas"));
}
示例15: create
public function create($playerID)
{
Log::add('made it to incentive create');
Validate::player($playerID);
$hash = filter_input(INPUT_POST, "key");
$type = filter_input(INPUT_POST, "incType");
//for this to work, there has to be a player record with the last sessionID == hash
$incentiveModel = new IncentiveModel();
if ($incentiveModel->create($hash, $playerID, $type)) {
$this->printJson(array('status' => 'ok', 'key' => $hash));
} else {
$this->printJson(array('status' => 'error'));
}
}