本文整理汇总了PHP中log_msg函数的典型用法代码示例。如果您正苦于以下问题:PHP log_msg函数的具体用法?PHP log_msg怎么用?PHP log_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($url, $params = [])
{
$params["auth_token"] = $this->auth_token;
$params['apikey'] = $this->apikey;
$params['version'] = self::VERSTION;
$path = self::BASE_URL . $url . "?" . http_build_query($params);
$process = curl_init($path);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$page = curl_exec($process);
$this->error = curl_error($process);
log_msg("ridewithgps " . $path);
log_msg($page);
if ($this->error) {
log_msg("ERROR: " . $this->error);
}
log_msg("Total time: " . curl_getinfo($process)["total_time"]);
curl_close($process);
if ($page) {
return $page;
} else {
return $this->error;
}
}
示例2: array_matches
function array_matches($have, $should, $name = 'array')
{
$ret = true;
if (is_array($have)) {
foreach ($should as $key => $value) {
if (!array_key_exists($key, $have)) {
log_msg('Missing: ' . $key);
$ret = false;
} else {
if (is_array($value) && is_array($have[$key])) {
$ret &= array_matches($have[$key], $value);
} else {
if (is_array($value) || is_array($have[$key])) {
log_msg('Type mismatch: ' . $key);
$ret = false;
} else {
if (!fnmatch($value, $have[$key])) {
log_msg("Failed comparison: {$key}={$have[$key]} (expected {$value})");
$ret = false;
}
}
}
}
}
} else {
log_msg('Not an array: ' . $name);
$ret = false;
}
return $ret;
}
示例3: get
public function get($url, $params = [])
{
if (!$this->apikey) {
$this->error = "No Google maps api key set";
return false;
}
$this->error = "";
$retries = 3;
$params['key'] = $this->apikey;
$url = self::BASE_URL . $url . "?" . http_build_query($params);
$process = curl_init($url);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$page = false;
// make IDE happy
for ($i = 0; $i < $retries; $i++) {
$page = curl_exec($process);
$error = curl_error($process);
if ($error) {
$this->error .= "{$error}\n";
}
if ($page) {
break;
}
}
log_msg("google " . $url);
log_msg($page);
if ($error) {
log_msg("ERROR: " . $error);
}
log_msg("Total time: " . curl_getinfo($process)["total_time"]);
curl_close($process);
return $page;
}
示例4: api
/**
* @param $key
* @param $secret
* @return BTCeAPI
*/
static function api($key, $secret)
{
try {
$api = new BTCeAPI($key, $secret);
return $api;
} catch (BtceLibException $e) {
log_msg('Connection failed: ' . $e->getMessage(), true);
}
}
示例5: init
public static function init($dbtype, $config)
{
if (!in_array($dbtype, self::$valid_drivers)) {
log_msg('无效的数据库驱动!', __CLASS__);
//此处引用了公共函数
}
$dbtype = 'DB_' . $dbtype;
require_once SYS_PATH . 'database/drivers/' . $dbtype . '.php';
//引入相关数据库驱动文件
$db = new $dbtype();
$db->connect($config);
return $db;
}
示例6: __construct
function __construct($path)
{
log_msg("Storage::construct >> inited");
$this->_src = $path;
if (file_exists($this->_src)) {
$_file = file_get_contents($this->_src);
$_dataArr = json_decode($_file, true);
log_msg("Storage::construct >> load from " . $this->_src);
} else {
throw new StorageException(StorageException::$messages[StorageException::DATA_FILE_NOT_FOUND], StorageException::DATA_FILE_NOT_FOUND);
}
$this->data = new StorageData($_dataArr);
}
示例7: readjsonstring
/**
* 进行json字符串标准化,并解析json后返回对象
* @param string $filepath 配置文件路径
* @return boolean|object 解析是失败返回NULL并有错误记录,配置文件为空则返回FALSE,正确解析返回Obj
*/
static final function readjsonstring($filepath)
{
$jsonstring = file_get_contents($filepath);
if (empty($jsonstring)) {
return FALSE;
}
$pattern = array('~#.*\\n~', '~(\\s*)(\\S+)(\\s*)(\\S+)(\\s*)~', '~\\,\\}~', '~\\,\\]~');
$replacement = array('', '$2$4', '}', ']');
$jsonstring = preg_replace($pattern, $replacement, $jsonstring);
$json = json_decode($jsonstring);
empty($json) && log_msg($filepath . PHP_EOL . $jsonstring, '配置文件解析失败,请检查文件内容');
return $json;
}
示例8: log_error
/**
* logs error into database using functions defined in log.php
*/
function log_error($level, $code, $msg, $mysql_msg = "NONE")
{
$er_code = $this->er_code_prefix + $code;
//call to a predefined function
$log_id = log_msg($level, $er_code, $msg, $mysql_msg);
//if log id is false return 0;
if (!$log_id) {
return 0;
}
//display this code to user
$this->error = "{$er_code}-{$log_id}";
return $log_id;
}
示例9: log_new_file
function log_new_file()
{
global $_log_file;
global $_state;
global $debug;
global $_log;
$_log = fopen($_log_file, "w");
log_msg();
log_msg('==========');
log_msg('Request: ' . date("Y-m-d") . ' ' . date("H:i:s"));
log_msg('File: ' . $_SERVER['PHP_SELF']);
log_msg();
log_msg($_state);
$debug = true;
}
示例10: delete_workorder
function delete_workorder($woinfo)
{
global $username;
$loc = rmabs(__FILE__ . ".delete_workorder");
$wid = $woinfo["WID"];
$sql = "DELETE FROM Assignments WHERE WID=" . intval($wid);
SqlQuery($loc, $sql);
$sql = "DELETE FROM AppendedData WHERE WID=" . intval($wid);
SqlQuery($loc, $sql);
$sql = "DELETE FROM WorkOrders WHERE WID=" . intval($wid);
SqlQuery($loc, $sql);
$widstr = WIDStr($wid, $woinfo["Revision"], $woinfo["IsApproved"]);
$msg = "Work Order " . $widstr . " deleted by " . $username . ".";
log_msg($loc, $msg);
return $msg;
}
示例11: getPage
public function getPage($url)
{
$process = curl_init(self::REST_SERVER_BASE_URL . $url);
$headers = array('Authorization: Basic ' . $this->auth);
curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$page = curl_exec($process);
log_msg("MCL get URL " . $url);
log_msg($page);
$error = curl_error($process);
if ($error) {
log_msg("ERROR: " . $error);
}
log_msg("Total time: " . curl_getinfo($process)["total_time"]);
curl_close($process);
return $page;
}
示例12: main
function main($server_cfg)
{
$eu_conf = parse_ini_file($server_cfg['eu_conf_file'], true);
$db_host = $eu_conf['DB']['host'];
$db_user = $eu_conf['DB']['user'];
$db_pwd = $eu_conf['DB']['password'];
$log_file = sprintf($server_cfg['log_file'], "add_correct_p_tag");
log_msg("Starting [partition_dynamics]", $log_file);
log_msg("db_host: {$db_host}", $log_file);
$con = mysql_connect($db_host, $db_user, $db_pwd);
$con or die("mysql_connect failed: " . mysql_error());
$query = "select table_schema from information_schema.tables where\n table_name = 'xhprof_blob_30min'";
$res_a = mysql_query_p($query, $con, $log_file);
$db_array = array();
while ($row_a = mysql_fetch_assoc($res_a)) {
$db_array[] = $row_a['table_schema'];
}
add_correct_p_tag($db_array, $con, $log_file);
mysql_close($con);
}
示例13: post
public function post($url, $params = [], $body = "")
{
//this functionality is part of addtrack for endomondo, and not working yet.
if (!$this->auth) {
return null;
}
if (!$params) {
$params = [];
}
$params["authToken"] = $this->auth;
$path = self::BASE_URL . $url . "?" . http_build_query($params);
$process = curl_init($path);
// $process = curl_init("http://localhost/~jem/EddingtonAndMore/j.php". "?" . http_build_query($params));
curl_setopt($process, CURLOPT_HEADER, 0);
vd("about to curl");
vd($body);
curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type' => 'application/octet-stream'));
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($process, CURLOPT_POSTFIELDS, $body);
$page = curl_exec($process);
$this->error = curl_error($process);
log_msg("endomondo post " . $path);
log_msg($params);
log_msg($page);
if ($this->error) {
log_msg("ERROR: " . $this->error);
}
log_msg("Total time: " . curl_getinfo($process)["total_time"]);
curl_close($process);
if ($page) {
return $page;
} else {
return $this->error;
}
}
示例14: MakeGif
function MakeGif($data)
{
global $config;
$loc = 'badgeli.php->MakeGif';
if (isset($data["UserID"])) {
$userid = intval($data["UserID"]);
} else {
$msg = 'UserID not given.';
log_error($loc, $msg);
return $msg;
}
if (!isset($data["BadgeID"])) {
$msg = 'BadgeID not given for UserID = ' . $userid;
log_error($loc, $msg);
return $msg;
}
if (!isset($data["PicID"])) {
$msg = 'PicID not given for UserID = ' . $userid;
log_error($loc, $msg);
return $msg;
}
$badgeid = $data["BadgeID"];
$picid = intval($data["PicID"]);
if (!VerifyBadgeFormat($badgeid)) {
$msg = 'Bad Badge Format. Must be in form of "A000".';
log_error($loc, $msg);
return $msg;
}
if ($picid <= 0) {
$msg = 'User ' . $userid . ' does not have a picture.';
log_error($loc, $msg);
return $msg;
}
CheckBadgeDir();
// We have a image to put on the badge!
$picfile = PicPathName($picid, 'standard');
// Standard should have more than enough resolution.
$imginfo = @getimagesize($picfile);
if ($imginfo === false) {
$msg = 'Getimagesize() failed on our image: ' . $picfile;
log_error($loc, $msg);
return $msg;
}
$picwidth = $imginfo[0];
$picheight = $imginfo[1];
$picimg = @imagecreatefromjpeg($picfile);
if ($picimg === false) {
$msg = 'imagecreatefromjpeg() failed on our image: ' . $picfile;
log_error($loc, $msg);
return $msg;
}
$scale = 260 / $picheight;
$xsize = intval($picwidth * $scale);
$ysize = intval($picheight * $scale);
$img = imagecreatetruecolor($xsize, $ysize);
$result = @imagecopyresampled($img, $picimg, 0, 0, 0, 0, $xsize, $ysize, $picwidth, $picheight);
if ($result === false) {
$msg = 'imagecopyresized() failed for PidId=' . $picid;
log_error($loc, $msg);
return $msg;
}
$outfile = $config["UploadDir"] . 'gifs/' . $badgeid . '.gif';
$result = imagegif($img, $outfile);
if ($result === false) {
$msg = 'imagegif() failed for PicID=' . $picid;
log_error($loc, $msg);
return $msg;
}
log_msg($loc, 'Image Successfully made for BadgeID= ' . $badgeid . '.');
return true;
}
示例15: write_user_data
public function write_user_data()
{
file_put_contents($this->_users_file, $this->_jsonify_users());
log_msg(USER_LOG, "User inventory data written to file \"{$this->_users_file}\"");
}