当前位置: 首页>>代码示例>>PHP>>正文


PHP logger::warn方法代码示例

本文整理汇总了PHP中logger::warn方法的典型用法代码示例。如果您正苦于以下问题:PHP logger::warn方法的具体用法?PHP logger::warn怎么用?PHP logger::warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在logger的用法示例。


在下文中一共展示了logger::warn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registerProvider

 public static function registerProvider(ContentProvider $provider)
 {
     $ns = $provider->getNamespace();
     if (isset(self::$providers[$ns])) {
         logger::warn('Overwriting previous handler for %s', $ns);
     }
     self::$providers[$ns] = $provider;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:8,代码来源:content.php

示例2: error_reporting

<?php

require "./framework/classloader.php";
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('html_errors', false);
date_default_timezone_set('Asia/Chongqing');
// 初始化类加载器
$loader = new classloader();
// 日志的使用
// 初始化
logger::init(array());
//参数: ($msg, $moduleName)
logger::info("testing mes", "index.php");
logger::warn("oh no warning", "index.php");
logger::trace("hei hei tracing", "index.php");
logger::debug("just debug", "index");
logger::debug("just debug, 只是debug,不用怕", "index");
// 配置信息
$config = array("dbhost" => "localhost", "dbuser" => "root", "dbpwd" => "", "dbname" => "test", "dbcharset" => "utf-8", "pconnect" => 0);
// 初始化
try {
    database::init($config);
} catch (DbException $dbe) {
    echo 'can not connect to database' . $dbe;
}
// 主要四个方法:
// database::execute($sql)
// database::fetch_all($sql)
// database::fetch_one($sql)
try {
开发者ID:laiello,项目名称:open-portal,代码行数:31,代码来源:dbtest.php

示例3: accept

 public function accept()
 {
     if ($this->sockstate == SOCKSTATE_LISTENING) {
         $sh = socket_accept($this->fsh);
         if ($sh) {
             $sock = new TcpSocket($sh);
             return $sh;
         } else {
             return false;
         }
     } else {
         logger::warn("Can't accept on non-listening socket");
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:14,代码来源:sockets.php

示例4: continueWithFoundLinks

 /**
  * @return void
  */
 public function continueWithFoundLinks()
 {
     //reset DB in case this is executed in a forked child process
     $this->db = Pimcore_Resource_Mysql::reset();
     try {
         $row = $this->db->fetchRow("SELECT * FROM plugin_searchphp_frontend_crawler_todo ORDER BY id", array());
         $nextLink = $row['uri'];
         $depth = $row['depth'];
         $cookieJar = unserialize($row['cookiejar']);
     } catch (Exception $e) {
         // probably table was already removed because crawler is finished
         logger::log(get_class($this) . ": Could not extract next link from table plugin_searchphp_frontend_crawler_todo ", Zend_Log::DEBUG);
         return;
     }
     if (empty($nextLink)) {
         return;
     }
     $client = Pimcore_Tool::getHttpClient();
     $client->setUri($nextLink);
     $client->setConfig(array('maxredirects' => $this->maxRedirects, 'keepalive' => true, 'timeout' => $this->timeout));
     $client->setCookieJar($cookieJar);
     $client->setHeaders('If-Modified-Since', null);
     while ($nextLink) {
         try {
             $this->db->delete("plugin_searchphp_frontend_crawler_todo", "id = '" . md5($nextLink) . "'");
         } catch (Exception $e) {
             logger::warn(get_class($this) . ": Could not delete from plugin_searchphp_frontend_crawler_todo - maybe forcing crawler stop right now?");
         }
         if ($depth <= $this->maxLinkDepth) {
             logger::debug(get_class($this) . ": Link depth [ {$depth} ]");
             try {
                 $nextLink = $this->addEvictOutputFilterParameter($nextLink);
                 $client->setUri($nextLink);
                 $client->setCookieJar($cookieJar);
                 $client->setHeaders('If-Modified-Since', null);
                 try {
                     $response = $client->request();
                 } catch (Zend_Http_Client_Adapter_Exception $e) {
                     logger::log(get_class($this) . ": Could not get response for Link [ {$nextLink} ] ", Zend_Log::ERR);
                 }
                 if ($response instanceof Zend_Http_Response and ($response->isSuccessful() or $response->isRedirect())) {
                     //we don't use port - crawler ist limited to standard port 80
                     $client->getUri()->setPort(null);
                     //update url - maybe we were redirected
                     $nextLink = $client->getUri(true);
                     $nextLink = $this->removeOutputFilterParameters($nextLink);
                     $valid = $this->validateLink($nextLink);
                     if ($valid) {
                         //see if we were redirected to a place we already have in fetch list or done
                         try {
                             $rowTodo = $this->db->fetchRow("SELECT count(*) as count from plugin_searchphp_frontend_crawler_todo WHERE id ='" . md5($nextLink) . "'");
                         } catch (Exception $e) {
                             logger::log(get_class($this) . ": could not fetch from plugin_searchphp_contents_temp", Zend_Log::DEBUG);
                         }
                         try {
                             $rowDone = $this->db->fetchRow("SELECT count(*) as count from plugin_searchphp_contents_temp WHERE id ='" . md5($nextLink) . "'");
                         } catch (Exception $e) {
                             logger::log(get_class($this) . ": could not fetch from plugin_searchphp_contents_temp", Zend_Log::DEBUG);
                         }
                         try {
                             $rowNoIndex = $this->db->fetchRow("SELECT count(*) as count from plugin_searchphp_frontend_crawler_noindex WHERE id ='" . md5($nextLink) . "'");
                         } catch (Exception $e) {
                             logger::log(get_class($this) . ": could not fetch from plugin_searchphp_frontend_crawler_noindex", Zend_Log::DEBUG);
                         }
                         if ($rowTodo['count'] > 0 or $rowDone['count'] > 0 or $rowNoIndex['count'] > 0) {
                             logger::log(get_class($this) . " Redirected to uri [ {$nextLink} ] - which has already been processed", Zend_Log::DEBUG);
                         } else {
                             try {
                                 $success = $this->parse($nextLink, $response, $client->getUri()->getHost(), $client->getCookieJar(), $depth);
                                 logger::log(get_class($this) . ": parsed  [ {$nextLink} ] ", Zend_Log::DEBUG);
                             } catch (Exception $e) {
                                 logger::log($e, Zend_Log::ERR);
                             }
                         }
                     } else {
                         logger::log("We were redirected to an invalid Link [ {$nextLink}]", Zend_Log::DEBUG);
                     }
                 } else {
                     logger::log(get_class($this) . ": Error parsing  [ {$nextLink} ] ", Zend_Log::ERR);
                 }
             } catch (Zend_Uri_Exception $e) {
                 logger::log(get_class($this) . ": Invalid URI  [ {$nextLink} ] ", Zend_Log::ERR);
             }
         } else {
             logger::alert(get_class($this) . ": Stopping with uri [ {$nextLink} ] because maximum link depth of [ {$depth} ] has been reached.");
         }
         //get next from DB
         try {
             $row = $this->db->fetchRow("SELECT * FROM plugin_searchphp_frontend_crawler_todo ORDER BY id", array());
             $nextLink = $row['uri'];
             $depth = $row['depth'];
             $cookieJar = unserialize($row['cookiejar']);
         } catch (Exception $e) {
             //wait 2 seconds then try again
             sleep(2);
             try {
                 $row = $this->db->fetchRow("SELECT * FROM plugin_searchphp_frontend_crawler_todo ORDER BY id", array());
//.........这里部分代码省略.........
开发者ID:weblizards-gmbh,项目名称:search-php,代码行数:101,代码来源:Crawler.php

示例5: generateSitemap

 /**
  * @return void
  */
 public static function generateSitemap()
 {
     $sitemapDir = PIMCORE_WEBSITE_PATH . "/var/search/sitemap";
     if (is_dir($sitemapDir) and !is_writable($sitemapDir)) {
         $sitemapDirAvailable = false;
     } else {
         if (!is_dir($sitemapDir)) {
             $sitemapDirAvailable = mkdir($sitemapDir, 0755, true);
             chmod($sitemapDir, 0755);
         } else {
             $sitemapDirAvailable = true;
         }
     }
     if ($sitemapDirAvailable) {
         $db = Pimcore_Resource_Mysql::get();
         $hosts = $db->fetchAll("SELECT DISTINCT host from plugin_searchphp_contents");
         if (is_array($hosts)) {
             //create domain sitemaps
             foreach ($hosts as $row) {
                 $host = $row['host'];
                 $data = $db->fetchAll("SELECT * FROM plugin_searchphp_contents WHERE host = '" . $host . "' AND content != 'canonical' AND content!='noindex' ORDER BY uri", array());
                 $name = str_replace(".", "-", $host);
                 $filePath = $sitemapDir . "/sitemap-" . $name . ".xml";
                 $fh = fopen($filePath, 'w');
                 fwrite($fh, '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n");
                 fwrite($fh, '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
                 fwrite($fh, "\r\n");
                 foreach ($data as $row) {
                     $uri = str_replace("&pimcore_outputfilters_disabled=1", "", $row['uri']);
                     $uri = str_replace("?pimcore_outputfilters_disabled=1", "", $uri);
                     fwrite($fh, '<url>' . "\r\n");
                     fwrite($fh, '    <loc>' . htmlspecialchars($uri, ENT_QUOTES) . '</loc>' . "\r\n");
                     fwrite($fh, '</url>' . "\r\n");
                 }
                 fwrite($fh, '</urlset>' . "\r\n");
                 fclose($fh);
             }
             //create sitemap index file
             $filePath = $sitemapDir . "/sitemap.xml";
             $fh = fopen($filePath, 'w');
             fwrite($fh, '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n");
             fwrite($fh, '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
             fwrite($fh, "\r\n");
             foreach ($hosts as $row) {
                 $host = $row['host'];
                 $name = str_replace(".", "-", $host);
                 //first host must be main domain - see hint in plugin settings
                 $currenthost = $hosts[0]['host'];
                 fwrite($fh, '<sitemap>' . "\r\n");
                 fwrite($fh, '    <loc>http://' . $currenthost . "/plugin/SearchPhp/frontend/sitemap/?sitemap=sitemap-" . $name . ".xml" . '</loc>' . "\r\n");
                 fwrite($fh, '</sitemap>' . "\r\n");
             }
             fwrite($fh, '</sitemapindex>' . "\r\n");
             fclose($fh);
         } else {
             logger::warn("SearchPhp_Tool: could not generate sitemaps, did not find any hosts in index.");
         }
     } else {
         logger::emerg("SearchPhp_Tool: Cannot generate sitemap. Sitemap directory [ " . $sitemapDir . " ]  not available/not writeable and cannot be created");
     }
 }
开发者ID:weblizards-gmbh,项目名称:search-php,代码行数:64,代码来源:Tool.php


注:本文中的logger::warn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。