本文整理汇总了PHP中LogUtil::getLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP LogUtil::getLogger方法的具体用法?PHP LogUtil::getLogger怎么用?PHP LogUtil::getLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogUtil
的用法示例。
在下文中一共展示了LogUtil::getLogger方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateMemcache
function updateMemcache()
{
// ignore_user_abort();
//set_time_limit(0);
//$interval=3600; //(seconds)
require_once 'model/Feed.php';
require_once 'lib/BitMemCache.php';
require_once 'lib/RssReader.php';
$feed = new Feed();
$feeds = $feed->getFeeds();
$logger = LogUtil::getLogger();
//do{
include "config/site.php";
foreach ($feeds as $feed) {
$url = $feed['url'];
$mem = new BitMemCache();
$reader = new RssReader();
$rss = $reader->fetch($url);
if (!$rss) {
} else {
if ($mem->init()) {
$mem->set($url, json_encode($rss));
$logger->info("update memcache {$url}");
}
}
}
// sleep($interval);
//}while($memcache);
}
示例2: __construct
function __construct()
{
include "config/config.php";
//no include_once, because only first new XXX() will include config.php
$this->db = new MySQL($mysql_host, $mysql_user, $mysql_pass, $mysql_dbname);
$this->logger = LogUtil::getLogger();
}
示例3: fetch
function fetch($url)
{
$cacheDir = "cache/";
$cacheName = base64_encode($url);
$fullUrl = $cacheDir . $cacheName;
$hasCache = is_file($fullUrl);
require_once "lib/LogUtil.php";
$logger = LogUtil::getLogger();
if ($hasCache) {
// 有缓存且缓存的时间不超过6小时则使用缓存
$t1 = filemtime($fullUrl);
$t2 = time();
$inter = $t2 - $t1;
if ($inter < 3600 * 6) {
$url = $fullUrl;
$logger->info("fullUrl = {$fullUrl} inter={$inter} t1={$t1}");
} else {
$hasCache = false;
$logger->info("inter={$inter}");
}
}
$logger->info("url={$url}");
$buff = "";
$timeout = array('http' => array('timeout' => 20));
$ctx = stream_context_create($timeout);
$fp = fopen($url, "r", false, $ctx);
if (!$fp) {
return false;
}
while (!feof($fp)) {
$buff .= fgets($fp, 4096);
}
fclose($fp);
if (strlen($buff) <= 0) {
return false;
}
//$pattern="/<!\[CDATA\[(.*?)\]\]>/";
//preg_match_all($pattern, $str,$out);
//var_dump($out);
$from_str = "encoding=\"gb2312\"";
$to_str = "encoding=\"UTF-8\"";
$char_set = mb_detect_encoding($buff);
if ($char_set == 'UTF-8') {
} else {
// $buff = mb_convert_encoding($buff,'utf-8','gb2312'); --不支持生僻字,需改成GBK
$buff = mb_convert_encoding($buff, 'utf-8', 'GBK');
$buff = str_replace($from_str, $to_str, $buff);
}
if (!$hasCache) {
$cacheFp = fopen($fullUrl, 'w+');
fwrite($cacheFp, $buff);
fclose($cacheFp);
$t3 = filemtime($fullUrl);
$logger->info("fullUrl={$fullUrl} t3={$t3}");
}
return simplexml_load_string($buff, 'SimpleXMLElement', LIBXML_NOCDATA);
}
示例4: __construct
function __construct($path, $usr, $pass_wd, $db_name)
{
if ($this->conn == null) {
$this->conn = mysql_connect($path, $usr, $pass_wd, true) or die("cannot connect datebase " . $path . " :" . mysql_error());
mysql_select_db($db_name, $this->conn) or die("cannot select datebase " . $db_name . " :" . mysql_error());
mysql_query("SET NAMES UTF8");
}
$this->logger = LogUtil::getLogger();
}
示例5: saveTpl
public function saveTpl()
{
$arr = array('tpl_name', 'tpl_root');
$_POST['tpl_root'] = "view/template/" . $_POST['tpl_name'];
require_once "lib/LogUtil.php";
$logger = LogUtil::getLogger();
//$logger->info($_POST['tpl_name']);
//$logger->info($_POST['tpl_root']);
return $this->db->postInsertPair("siteparas", $arr);
}
示例6: listPage
function listPage()
{
$postTile = "";
$postBlockName = "";
$sts = "1";
if (isset($_POST['title'])) {
$postTile = $_POST["title"];
}
if (isset($_POST['sts'])) {
$sts = $_POST["sts"];
}
if (isset($_POST['block_name'])) {
$postBlockName = $_POST["block_name"];
}
$table = "(select a.*,b.block_name,c.usr_nm from content a left join block b on a.block_id=b.block_id left join users c on a.usr_id=c.usr_id where a.sts in (" . formatString($sts) . ") and a.title like '%" . $postTile . "%' and b.block_name like '%" . $postBlockName . "%' order by edit_tm desc) mytable";
$this->logger = LogUtil::getLogger();
//$this->logger->info($table);
$pager = parent::getPager($table, $this->content->db);
$arrayList = $pager->getData();
$blockList = $this->block->getBlocks();
require 'view/admin/content_list.php';
}
示例7: flushMem
function flushMem()
{
$mem = new BitMemCache();
if ($mem->init()) {
$logger->info("init 2");
$logger = LogUtil::getLogger();
$ret = $mem->flush();
$logger->info("flush memcache ------------[ {$ret} ]");
}
echo "flushMem 2";
}
示例8: __construct
function __construct()
{
parent::__construct();
$this->logger = LogUtil::getLogger();
}