本文整理汇总了PHP中logInfo函数的典型用法代码示例。如果您正苦于以下问题:PHP logInfo函数的具体用法?PHP logInfo怎么用?PHP logInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
global $system;
global $params;
global $BD;
global $labels;
global $dbParams;
global $usuario;
global $requiereLogueo;
global $noVerificarCambioPass;
global $nivel;
global $urlVolver;
// Leo las propiedades de los archivos de configuracion
$system = obtProperties("system.properties");
$labels = obtProperties("labels.properties");
$dbParams = obtProperties("bd.properties");
// Consigo la conexion con la base de datos
$BD = new BDCon($dbParams);
// Leo los parametros de configuracion de la base de datos
$params = Parametro::obtTodos($BD);
$usuario = new Usuario();
// Cargo la sesion, si es que hay
$usuario->cargarSesion($BD);
if ($requiereLogueo && (!$usuario->logueado() || !$usuario->tieneAcceso($nivel))) {
logInfo("Intento de acceso a '" . $system["URL_BASE"] . $urlVolver . "'." . "Redirrecionado a '" . $system["URL_SINACCESO"] . "'.");
redirect($system["URL_SINACCESO"]);
return false;
}
if (!$noVerificarCambioPass && $usuario->getCambiarPass() == 'S') {
redirect($system["URL_CAMBIAR"]);
}
return true;
}
示例2: logMessage
function logMessage($logLevel)
{
if ($logLevel == 'info') {
return logInfo();
} elseif ($logLevel == 'error') {
return logError();
} else {
return "[UNK], '{$logLevel}' is unknown.";
}
}
示例3: logInfo
/**
* logInfo
* to help debugging Payment notification for example
* Keep it for compatibilty
*/
protected function logInfo ($text, $type = 'message', $doLog=false) {
if (!class_exists( 'VmConfig' )) require(JPATH_COMPONENT_ADMINISTRATOR .'/helpers/config.php');
VmConfig::loadConfig();
if ((isset($this->_debug) and $this->_debug) OR $doLog) {
$oldLogFileName= VmConfig::$logFileName;
VmConfig::$logFileName =$this->getLogFileName() ;
logInfo($text, $type);
VmConfig::$logFileName =$oldLogFileName;
}
}
示例4: parseUrlReal
exit;
}
///Parse the URL and retrieve the PageID of the request page if its valid
$pageId = parseUrlReal($pageFullPath, $pageIdArray);
///Means that the requested URL is not valid.
if ($pageId === false) {
define("TEMPLATE", getPageTemplate(0));
$pageId = parseUrlReal("home", $pageIdArray);
$TITLE = CMS_TITLE;
$MENUBAR = '';
$CONTENT = "The requested URL was not found on this server.<br />{$_SERVER['SERVER_SIGNATURE']}" . "<br /><br />Click <a href='" . $urlRequestRoot . "'>here </a> to return to the home page";
templateReplace($TITLE, $MENUBAR, $ACTIONBARMODULE, $ACTIONBARPAGE, $BREADCRUMB, $SEARCHBAR, $PAGEKEYWORDS, $INHERITEDINFO, $CONTENT, $FOOTER, $DEBUGINFO, $ERRORSTRING, $WARNINGSTRING, $INFOSTRING, $STARTSCRIPTS, $LOGINFORM);
exit;
}
///If it reaches here, means the page requested is valid. Log the information for future use.
logInfo(getUserEmail($userId), $userId, $pageId, $pageFullPath, getPageModule($pageId), $action, $_SERVER['REMOTE_ADDR']);
///The URL points to a file. Download permissions for the file are handled inside the download() function in download.lib.php
if (isset($_GET['fileget'])) {
require_once $sourceFolder . "/download.lib.php";
$action = "";
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
download($pageId, $userId, $_GET['fileget'], $action);
exit;
}
///Check whether the user has the permission to use that action on the requested page.
$permission = getPermissions($userId, $pageId, $action);
///Gets the page-specific template for that requested page
define("TEMPLATE", getPageTemplate($pageId));
///Gets the page title of the requested page
示例5: logMessage
<?php
function logMessage($logLevel, $message)
{
$fileDate = date('Y-m-d');
$filename = "log-{$fileDate}.log";
$logDate = date('Y-m-d H:i:s');
$string = $logDate . ' [' . $logLevel . '] ' . $message . PHP_EOL;
if (file_exists($filename)) {
file_put_contents($filename, $string, FILE_APPEND);
} else {
file_put_contents($filename, $string);
}
}
logMessage("INFO", "This is an info message.");
logMessage("ERROR", "This is an error message.");
function logInfo($message)
{
$logLevel = "INFO";
logMessage($logLevel, $message);
}
logInfo("Today is Monday.");
function logError($message)
{
$logLevel = "ERROR";
logMessage($logLevel, $message);
}
logError("logError() && logInfo() functions are useless.");
示例6: logMessage
<?php
function logMessage($logLevel, $message)
{
$date = date("Y-m-d H:i:s");
$string_to_append = PHP_EOL . "{$date} [{$logLevel}] {$message}";
$file = 'log-YYYY-MM-DD.log';
$handle = fopen($file, 'a');
fwrite($handle, $string_to_append);
fclose($handle);
}
function logInfo($info)
{
logMessage("INFO", "{$info}");
}
function logError($info)
{
logMessage("ERROR", $info);
}
// logMessage("INFO", "This is an info message.");
// logMessage("ERROR", "This is an ERRORRRRRRRR message.");
logInfo("woot it worked");
logError("woot its now messed up");
示例7: webhook
public function webhook()
{
header("Content-type: text/html; charset=utf-8");
$appId = C('PAYMENT_APP_ID');
$appSecret = C('PAYMENT_APP_SECRET');
$jsonStr = file_get_contents("php://input");
logInfo('ReturnJson:' . $jsonStr);
//$jsonStr = file_get_contents(dirname(__FILE__)."/refund_json111.txt");
$msg = json_decode($jsonStr);
// webhook字段文档: http://beecloud.cn/doc/php.php#webhook
// 验证签名
$sign = md5($appId . $appSecret . $msg->timestamp);
if ($sign != $msg->sign) {
// 签名不正确
logWarn('Signature incorrect.');
exit;
}
// 此处需要验证购买的产品与订单金额是否匹配:
// 验证购买的产品与订单金额是否匹配的目的在于防止黑客反编译了iOS或者Android app的代码,
// 将本来比如100元的订单金额改成了1分钱,开发者应该识别这种情况,避免误以为用户已经足额支付。
// Webhook传入的消息里面应该以某种形式包含此次购买的商品信息,比如title或者optional里面的某个参数说明此次购买的产品是一部iPhone手机,
// 开发者需要在客户服务端去查询自己内部的数据库看看iPhone的金额是否与该Webhook的订单金额一致,仅有一致的情况下,才继续走正常的业务逻辑。
// 如果发现不一致的情况,排除程序bug外,需要去查明原因,防止不法分子对你的app进行二次打包,对你的客户的利益构成潜在威胁。
// 如果发现这样的情况,请及时与我们联系,我们会与客户一起与这些不法分子做斗争。而且即使有这样极端的情况发生,
// 只要按照前述要求做了购买的产品与订单金额的匹配性验证,在你的后端服务器不被入侵的前提下,你就不会有任何经济损失。
if ($msg->transactionType == "PAY") {
//messageDetail 参考文档
switch ($msg->channelType) {
case "WX":
$this->commonPayCallbackProcess($msg);
break;
case "ALI":
$this->commonPayCallbackProcess($msg);
break;
case "UN":
break;
}
} else {
if ($msg->transactionType == "REFUND") {
$this->refundCallbackProcess($msg);
}
}
//处理消息成功,不需要持续通知此消息返回success
echo 'success';
}
示例8: logMessage
<?php
function logMessage($logLevel, $message)
{
$today = date("Y-m-d");
$filename = 'log-' . $today . 'log';
$todayLog = date("Y-m-d h:i:s");
$handle = fopen($filename, 'a');
fwrite($handle, $todayLog . ' ' . $logLevel . ' ' . $message . PHP_EOL);
fclose($handle);
}
function logInfo($message)
{
logMessage("INFO", $message);
}
function logError($message)
{
logMessage("ERROR", $message);
}
// logMessage("INFO", "This is an info message.");
logInfo("This is an info message");
// logMessage("ERROR", "This is an error message.");
logError("This is an error message");
示例9: logInfo
/**
* logInfo
* to help debugging Payment notification for example
* Keep it for compatibilty
*/
protected function logInfo($text, $type = 'message', $doLog = false)
{
if (!class_exists('VmConfig')) {
require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
VmConfig::loadConfig();
if (isset($this->_debug) and $this->_debug or $doLog) {
$oldLogFileName = VmConfig::$logFileName;
VmConfig::$logFileName = $this->getLogFileName();
logInfo($text, $type);
VmConfig::$logFileName = $oldLogFileName;
}
}
示例10: createGameObject
/**
* This method creates a game object that is good for one game session. Everytime a game object is created, it is all random.
* The twitter users, their tweet, all random.
*
* NOTE: This method logs a bunch of stuff in a new live log html file called "gameSelectionLogs.html". This is done
* because even though the game object is created there is a minor glitch in creation of the game object. Some
* Tweets do not work when doing json_decode ("enigma-bug"). Sometiumes it works sometimes it doesnt.
*
* @return gameObject :: A json form string that could be converted into json in JS easily.
*/
function createGameObject()
{
// Get random 10 Twitter Users
$twitterUsers = getRandomTwitterUsers(10);
// Get Connection Link
$link = getConnection();
$correct = array();
$incorrect = array();
$userKeys = array();
foreach ($twitterUsers as $user) {
// Select a random number between 1 and 200
$rand = mt_rand(1, 200);
logInfo("gameSelectionLogs.html", "Grabbing Tweet Number: " . $rand . " for Twitter User: " . $user . " from the DB.");
$query = "SELECT TwitterResp FROM Tweets WHERE Number = " . (string) $rand . " AND TwitterHandle = \"" . $user . "\";";
$res = mysqli_query($link, $query);
$row = $res->fetch_array();
// Get the textual tweet response form the DB
$twitterResp = $row[0];
// Convert that text to associative array
$twitterRespJson = json_decode($twitterResp, true, 200000);
// Creating a new user variable jsut in case the last one fails
$newUser = $user;
// If it fails...
while ($twitterRespJson == null) {
logError("gameSelectionLogs.html", "Conversion of Tweet Response text from DB to JSON in PHP failed.");
logInfo("gameSelectionLogs.html", "Finding a new random Twitter User for the game...");
// Get new random twitter user
$newUser = getRandomTwitterUsers(1);
$newUser = $newUser[0];
// Select a random number between 1 and 200
$rand = mt_rand(1, 200);
logInfo("gameSelectionLogs.html", "Grabbing Tweet Number: " . $rand . " for Twitter User: " . $newUser . " from the DB.");
$query = "SELECT TwitterResp FROM Tweets WHERE Number = " . (string) $rand . " AND TwitterHandle = \"" . $newUser . "\";";
$res = mysqli_query($link, $query);
$row = $res->fetch_array();
// Grab the Twitter Response as text from the DB
$twitterResp = $row[0];
$twitterRespJson = json_decode($twitterResp, true, 20000);
}
logSuccess("gameSelectionLogs.html", "User: " . $newUser . " with Tweet Number: " . $rand . " has been selected for the game.");
// If Everything went OK
if ($twitterResp != "") {
$response = $twitterRespJson;
$userObj = array('name' => $response['user']['name'], 'handle' => '@' . $response['user']['screen_name'], 'profilePicURL' => str_replace("_normal", "", $response['user']['profile_image_url']), 'followURL' => "https://twitter.com/intent/follow?screen_name=" . '@' . $response['user']['screen_name']);
//var_dump($userObj);
$tweetObj = array('tweetID' => $response['id'], 'tweetDate' => $response['created_at'], 'tweetHTML' => getTweetHTML($response), 'tweetText' => $response['text'], 'numOfRetweets' => $response['retweet_count'], 'numOfFavorites' => $response['favorite_count']);
$unit = array('userInfo' => $userObj, 'tweetInfo' => $tweetObj);
array_push($userKeys, $response['user']['screen_name']);
$correct[$response['user']['screen_name']] = $unit;
}
}
logInfo("gameSelectionLogs.html", "'Correct' part of the game object has been COMPLETED. Starting the construction of 'incorrect' part of the game object.");
$incorrect = array();
// Variable to log the final Game Layout.
$gameObjectLog = "";
foreach ($correct as $unit) {
$rand = $rand = mt_rand(0, count($userKeys) - 1);
// Swap that random number with the last user in the userKeys array
if (count($userKeys) != 0) {
$temp = $userKeys[count($userKeys) - 1];
$userKeys[count($userKeys) - 1] = $userKeys[$rand];
$userKeys[$rand] = $temp;
}
// get random tweet user
$randomTwitterUser = array_pop($userKeys);
$gameObjectLog = $gameObjectLog . '<b>' . substr($unit['userInfo']['handle'], 1) . '</b> has <b>' . $randomTwitterUser . '\'s</b> tweet infront of him/her in the game. <br>';
// Select that random tweet from the correct part of game object and add in current incorrect unit
$incorrect[substr($unit['userInfo']['handle'], 1)]['userInfo'] = $correct[substr($unit['userInfo']['handle'], 1)]['userInfo'];
$incorrect[substr($unit['userInfo']['handle'], 1)]['tweetInfo'] = $correct[$randomTwitterUser]['tweetInfo'];
}
// Game object construction
$gameObject = array('correct' => $correct, 'incorrect' => $incorrect);
logSuccess("gameSelectionLogs.html", "Game Object Creation Successful. <br><u>GAME INFO:</u><br>" . $gameObjectLog);
logInfo("gameSessionObjects.txt", json_encode($gameObject));
return json_encode($gameObject);
}
示例11: chdir
<?php
/**
* DESCRIPCION
*
* @author Agustin Arias <aarias@adoxweb.com.ar>
*/
chdir("..");
include_once 'util/includes.php';
include_once 'util/util.php';
$usuario = new Usuario();
$username = $_POST["username"] ? $_POST["username"] : 'aarias';
$pass = $_POST["pass"] ? $_POST["pass"] : '';
if ($usuario->login($username, $pass, $BD)) {
logInfo("Login. Usuario: {$username}");
$ret["e"] = "OK";
} else {
logInfo("Fallo login. Usuario: {$username}");
$ret["e"] = "ERROR";
$ret["error"] = "<B>Lo sentimos.</B> La combinación de usuario y contraseña no es correcta.";
}
echo json_encode($ret);
示例12: testLogShoppingList
protected function testLogShoppingList()
{
$shoppingList = session('shoppingList');
logInfo('shoppingList totalItemCount:' . $shoppingList['totalItemCount'] . ',totalAmount:' . $shoppingList['totalAmount']);
$shoppingListItems = session('shoppingListItems');
logInfo('shoppingListItems:');
foreach ($shoppingListItems as $value) {
logInfo('itemId:' . $value['itemId'] . ',itemSize:' . $value['itemSize'] . ',itemName:' . $value['itemName'] . ',brandName:' . $value['brandName'] . ',itemImage:' . $value['itemImage'] . ',itemColor:' . $value['itemColor'] . ',sizeDescription:' . $value['sizeDescription'] . ',price:' . $value['price'] . ',quantity:' . $value['quantity']);
}
}
示例13: _processCommand
protected function _processCommand()
{
$this->repoPath = $this->reposPath . DIRECTORY_SEPARATOR . $this->repoName;
if ($this->gitCommand == 'git-annex-shell') {
if (!$this->config->gitAnnexEnabled()) {
Exception::throwException(30002, [$this->gitCommand, $this->user['name']]);
}
} else {
logInfo("find-shell: executing git command '{$this->gitCommand} {$this->repoPath} by " . $this->user['name'] . ".", $this->config->commonLogFile());
$this->_runCommand($this->gitCommand, array($this->repoPath));
}
}
示例14: date_default_timezone_set
date_default_timezone_set("America/Chicago");
function logMessage($logLevel, $message)
{
$todaysDate = date("Y-m-d");
$todaysDateTime = date("h:i:s A");
$filename = "log-{$todaysDate}.log";
$handle = fopen($filename, 'a');
$formattedMessage = $todaysDate . " " . $todaysDateTime . " " . $logLevel . " " . $message . PHP_EOL;
fwrite($handle, $formattedMessage);
fclose($handle);
}
function logInfo($message)
{
logMessage("INFO", $message);
}
function logError($message)
{
logMessage("ERROR", $message);
}
function logWarning($message)
{
logMessage("WARNING", $message);
}
function logCritical($message)
{
logMessage("CRITICAL", $message);
}
logInfo("This is an INFO message.");
logError("This is an ERROR message.");
logWarning("This is a WARNING message.");
logCritical("This is a CRITICAL message.");
示例15: logInfo
/// local DB for the Game Object.
///
/// Author: Vishrut Reddi
/// MidnightJabber (c) 2015 - 2016
// Got it from: https://github.com/themattharris/tmhOAuth
require 'tmhOAuth.php';
//Connect Connection Script
include "connection.php";
// To log data
include "logger.php";
// Use the data from http://dev.twitter.com/apps to fill out this info
// notice the slight name difference in the last two items)
// Log a new session start
logInfo('tweetylogs.txt', 'New Session Starting.');
logInfo('info.txt', 'New Session Starting.');
logInfo('tweetylogs.html', '<b>New Session Starting</b>');
insertTweetInDB();
//getTweet('@katyperry', 200);
/**
* This method retreives all the Twitter user handles from the local DB (midnight_tweety).
* All the handles exist inside the table 'TwitterUsers'.
*
* NOTE: Each handle has '@' infront of it.
* Each handle is a string and not an object containing a string.
*
* @return JSON OBJ {"result": [ __Array_of_handles__]}
*/
function getAllTwitterUsers()
{
$query = "SELECT TwitterHandle FROM TwitterUsers ORDER BY UserID;";
// Execute the query