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


PHP Logger类代码示例

本文整理汇总了PHP中Logger的典型用法代码示例。如果您正苦于以下问题:PHP Logger类的具体用法?PHP Logger怎么用?PHP Logger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: boot

 /**
  * Bootstrap a server from command line options
  *
  * @param \Aerys\Logger $logger
  * @param \Aerys\Console $console
  * @return \Aerys\Server
  */
 public function boot(Logger $logger, Console $console) : Server
 {
     $configFile = $this->selectConfigFile((string) $console->getArg("config"));
     $logger->info("Using config file found at {$configFile}");
     if (!(include $configFile)) {
         throw new \DomainException("Config file inclusion failure: {$configFile}");
     } elseif (!defined("AERYS_OPTIONS")) {
         $options = [];
     } elseif (is_array(AERYS_OPTIONS)) {
         $options = AERYS_OPTIONS;
     } else {
         throw new \DomainException("Invalid AERYS_OPTIONS constant: array expected, got " . gettype(AERYS_OPTIONS));
     }
     if ($console->isArgDefined("debug")) {
         $options["debug"] = true;
     }
     $options = $this->generateOptionsObjFromArray($options);
     $vhosts = new VhostContainer();
     $ticker = new Ticker($logger);
     $server = new Server($options, $vhosts, $logger, $ticker);
     $bootLoader = function (Bootable $bootable) use($server, $logger) {
         return $bootable->boot($server, $logger);
     };
     $hosts = \call_user_func($this->hostAggregator) ?: [new Host()];
     foreach ($hosts as $host) {
         $vhost = $this->buildVhost($host, $bootLoader);
         $vhosts->use($vhost);
     }
     return $server;
 }
开发者ID:hunslater,项目名称:aerys,代码行数:37,代码来源:Bootstrapper.php

示例2: stream

 public function stream(Git_HTTP_Command $command)
 {
     $cwd = '/tmp';
     $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"));
     if (ForgeConfig::get('sys_logger_level') == Logger::DEBUG) {
         $descriptorspec[2] = array('file', ForgeConfig::get('codendi_log') . '/git_http_error_log', 'a');
     }
     $pipes = array();
     $this->logger->debug('Command: ' . $command->getCommand());
     $this->logger->debug('Environment: ' . print_r($command->getEnvironment(), true));
     $process = proc_open($command->getCommand(), $descriptorspec, $pipes, $cwd, $command->getEnvironment());
     if (is_resource($process)) {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             fwrite($pipes[0], file_get_contents('php://input'));
         }
         fclose($pipes[0]);
         $first = true;
         while ($result = stream_get_contents($pipes[1], self::CHUNK_LENGTH)) {
             if ($first) {
                 list($headers, $body) = http_split_header_body($result);
                 foreach (explode("\r\n", $headers) as $header) {
                     header($header);
                 }
                 file_put_contents('php://output', $body);
             } else {
                 file_put_contents('php://output', $result);
             }
             $first = false;
         }
         fclose($pipes[1]);
         $return_value = proc_close($process);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:33,代码来源:Wrapper.class.php

示例3: GetItemsForCategoryForAPI

 public static function GetItemsForCategoryForAPI($category, $page, $itemsPerPage, $user)
 {
     $properties = new ReadeyProperties();
     $logFile = $properties->getLogFile();
     $logLevel = $properties->getLogLevel();
     $logger = new Logger($logLevel, $logFile);
     $limit = intval($itemsPerPage);
     $index = $page > 0 ? ($page - 1) * $itemsPerPage : 0;
     $itemArray = array();
     $startTime = microtime(true);
     $sql = "\n\t\t\tSELECT\n\t\t\t\tDISTINCT\n\t\t\t\tSQL_CALC_FOUND_ROWS\n\t\t\t\tri.uuid,\n\t\t\t\trf.title AS feedTitle,\n\t\t\t\tri.title,\n\t\t\t\tri.date,\n\t\t\t\trl.rssItemUuid AS alreadyRead,\n\t\t\t\tri.permalink,\n\t\t\t\tri.content\n\t\t\tFROM\n\t\t\t\trssItems ri\n\t\t\t\tJOIN rssFeeds rf ON rf.uuid = ri.feed\n\t\t\t\tJOIN rssCategories rc ON rc.uuid = rf.category\n\t\t\t\tLEFT JOIN readLogs rl ON rl.rssItemUuid = ri.uuid AND rl.user = '{$user}'\n\t\t\t\tJOIN category_feed cf ON cf.feed = ri.feed\n\t\t\tWHERE\n\t\t\t\tcf.category = '{$category}'\n\t\t\tORDER BY\n\t\t\t\tdate DESC\n\t\t\tLIMIT " . $index . "," . $limit . "\n\t\t";
     $result = mysql_query($sql);
     $queryTime = microtime(true) - $startTime;
     $resultCount = mysql_query("SELECT FOUND_ROWS()");
     $resultCountRows = mysql_fetch_array($resultCount);
     $itemArray[] = $resultCountRows[0];
     $itemArray[] = $queryTime;
     $logger->info('Query Exec Time: ' . $queryTime);
     while ($row = mysql_fetch_assoc($result)) {
         $row['date'] = date('D, n/j, g:i a', $row['date']);
         $row['wordCount'] = str_word_count($row['content']);
         $row['alreadyRead'] = $row['alreadyRead'] === NULL ? false : true;
         $itemArray[] = $row;
     }
     return $itemArray;
 }
开发者ID:dbarkman,项目名称:BotsFeedUsFramework,代码行数:26,代码来源:RSSItem.model.php

示例4: check

 public function check()
 {
     $username = $_POST['username'];
     $password = $_POST['password'];
     $conn = Db::getConnection();
     $sql = "SELECT username, password, admin\n\t\t\t\tFROM users\n\t\t\t\tWHERE username = '{$username}'";
     $q = $conn->prepare($sql);
     $q->execute();
     $users = $q->fetch(\PDO::FETCH_ASSOC);
     //var_dump($users);die('  proba');
     $logger = new Logger();
     $error = $logger->checkCredentials($password, $users);
     //$isAdmin = $logger->checkAdmin($password,$users);
     //var_dump($error);die('   ajde vise!!!');
     if ($error) {
         //echo '<pre>'; var_dump($error);die(); echo '</pre>';
         $html = new Html($this->controllerName);
         $html->error = $error;
         //echo '<pre>'; var_dump($html->error);die(); echo '</pre>';
         $html->render('index');
     } else {
         $user = new User($users['username'], $users['admin']);
         $user->login();
         //var_dump($user);die('   jebem li ga');
         header('Location: /');
     }
 }
开发者ID:Mikili975,项目名称:news_obj,代码行数:27,代码来源:LoginController.php

示例5: main_error_handler

 function main_error_handler($errno, $errstr, $errfile, $errline)
 {
     $logger_error = new Logger(array("dir" => APP_PATH . "/logs", "file" => date("Y-m-d") . ".txt", 'type' => Logger::TYPE_ERROR));
     $string = "[Error] " . "No. " . $errno . ", File: " . $errfile . ", Line: " . $errline . ", String: " . $errstr . ";";
     $logger_error->log($string);
     // throw new \Framework\Core\Exception($string);
 }
开发者ID:vjroby,项目名称:library,代码行数:7,代码来源:initialize.php

示例6: dealError

 public function dealError($type, $errorItem)
 {
     $path = BeanFinder::get('configs')->dicomErrorLog;
     $logger = new Logger('dicomerror', $path);
     $logger->addError('dicomparse error: ' . $type, array($this->file, $errorItem));
     throw new DicomParseException('dicomparse error');
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:7,代码来源:dicomparse.php

示例7: flickrthumbnails_crawl

function flickrthumbnails_crawl()
{
    global $THINKTANK_CFG;
    global $db;
    global $conn;
    if (isset($THINKTANK_CFG['flickr_api_key']) && $THINKTANK_CFG['flickr_api_key'] != '') {
        $logger = new Logger($THINKTANK_CFG['log_location']);
        $fa = new FlickrAPIAccessor($THINKTANK_CFG['flickr_api_key'], $logger);
        $ldao = new LinkDAO($db, $logger);
        $flickrlinkstoexpand = $ldao->getLinksToExpandByURL('http://flic.kr/');
        if (count($flickrlinkstoexpand > 0)) {
            $logger->logStatus(count($flickrlinkstoexpand) . " Flickr links to expand", "Flickr Plugin");
        } else {
            $logger->logStatus("No Flickr links to expand", "Flickr Plugin");
        }
        foreach ($flickrlinkstoexpand as $fl) {
            $eurl = $fa->getFlickrPhotoSource($fl);
            if ($eurl["expanded_url"] != '') {
                $ldao->saveExpandedUrl($fl, $eurl["expanded_url"], '', 1);
            } elseif ($eurl["error"] != '') {
                $ldao->saveExpansionError($fl, $eurl["error"]);
            }
        }
        $logger->close();
        # Close logging
    }
}
开发者ID:ukd1,项目名称:thinktank,代码行数:27,代码来源:flickrthumbnails.php

示例8: getProcessForQueue

 public function getProcessForQueue($request_queue)
 {
     $owner = SystemEvent::OWNER_APP;
     $custom_queues = array();
     $this->event_manager->processEvent(Event::SYSTEM_EVENT_GET_CUSTOM_QUEUES, array('queues' => &$custom_queues));
     if (isset($custom_queues[$request_queue])) {
         $this->logger = $custom_queues[$request_queue]->getLogger();
         $this->logger->debug('Processing ' . $request_queue . ' queue.');
         $process = new SystemEventProcessCustomQueue($request_queue);
         $owner = $custom_queues[$request_queue]->getOwner();
     } else {
         switch ($request_queue) {
             case SystemEvent::OWNER_APP:
                 $this->logger->debug('Processing default queue as app user.');
                 $process = new SystemEventProcessApplicationOwnerDefaultQueue();
                 break;
             case SystemEvent::DEFAULT_QUEUE:
                 $this->logger->debug('Processing default queue as root user.');
                 $owner = SystemEvent::OWNER_ROOT;
                 $process = new SystemEventProcessRootDefaultQueue();
                 break;
             default:
                 $this->logger->debug('Ignoring ' . $request_queue . ' queue.');
                 exit(0);
         }
     }
     if ($owner === SystemEvent::OWNER_APP) {
         return new SystemEventProcessor_ApplicationOwner($process, $this->system_event_manager, new SystemEventDao(), $this->logger);
     }
     return new SystemEventProcessor_Root($process, $this->system_event_manager, new SystemEventDao(), $this->logger, Backend::instance('Aliases'), Backend::instance('CVS'), Backend::instance('SVN'), Backend::instance('System'), new SiteCache($this->logger));
 }
开发者ID:ansarbek,项目名称:tuleap,代码行数:31,代码来源:SystemEventProcessor_Factory.php

示例9: addRemitFromPhone

    public function addRemitFromPhone($request, $response)
    {/*{{{*/
        $bankPhoneNo = $request->bankPhoneNo;
        $phoneNo = $request->phoneNo;
        //if($phoneNo != 13439853264 || $phoneNo != 13501126300)
        //{
        //    echo "错误的手机号";
        //    exit;
        //}
        $remitTime = $request->remitTime/1000;
        $remitTime = xdatetime::valueOfTime($remitTime);
        $message = mb_convert_encoding($request->message, "gbk", "utf-8");
        //$message = $request->message;

        $device = $request->device;
        $logger = new Logger('sms_remit', BeanFinder::get('configs')->remitLogPath, Logger::getLevelName(Logger::INFO));
        $logger->addInfo('device:'.$device.' bankPhoneNo:'.$bankPhoneNo.' phoneNo:'.$phoneNo.' message:'.$message);

        $recorder = DAL::get()->find_by_name('user', 'jm130');
        $res = AccountClient::getInstance()->createRemitAuto($recorder, $bankPhoneNo, $phoneNo, $remitTime, $message);

        if ($res['errorcode'] != 0 && false == empty($message)) 
        {
            $msg = $device." errorcode:".$res['errorcode']." message:".$message;
            //给whd & yyp & wk
            SMSClient::getInstance()->sendSMS(array(18612032258, 13691343423, 13720084864), $msg);
        }

        $res = json_encode($res);
        echo $res;
        return parent::DIRECT_OUTPUT;
    }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:32,代码来源:accountcontroller.php

示例10: testWriteln

 public function testWriteln()
 {
     $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->setMethods(array('emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug', 'log'))->getMock();
     $logger->expects($this->once())->method('info')->with($this->identicalTo('foobar' . PHP_EOL));
     $output = new Logger($logger);
     $output->writeln('foobar');
 }
开发者ID:seytar,项目名称:psx,代码行数:7,代码来源:LoggerTest.php

示例11: requestPage

 /**
  * Request the page from IMDb
  * @param $url
  * @return string Page html. Empty string on failure
  * @throws Exception\Http
  */
 protected function requestPage($url)
 {
     $this->logger->info("[Page] Requesting [{$url}]");
     $req = $this->buildRequest($url);
     if (!$req->sendRequest()) {
         $this->logger->error("[Page] Failed to connect to server when requesting url [{$url}]");
         if ($this->config->throwHttpExceptions) {
             throw new Exception\Http("Failed to connect to server when requesting url [{$url}]");
         } else {
             return '';
         }
     }
     if (200 == $req->getStatus()) {
         return $req->getResponseBody();
     } elseif ($redirectUrl = $req->getRedirect()) {
         $this->logger->debug("[Page] Following redirect from [{$url}] to [{$redirectUrl}]");
         return $this->requestPage($redirectUrl);
     } else {
         $this->logger->error("[Page] Failed to retrieve url [{url}]. Response headers:{headers}", array('url' => $url, 'headers' => $req->getLastResponseHeaders()));
         if ($this->config->throwHttpExceptions) {
             throw new Exception\Http("Failed to retrieve url [{$url}]. Status code [{$req->getStatus()}]");
         } else {
             return '';
         }
     }
 }
开发者ID:riverstore,项目名称:imdbphp,代码行数:32,代码来源:Pages.php

示例12: stopQuery

 /**
  * Mark the last started query as stopped. This can be used for timing of queries.
  *
  * @return void
  */
 public function stopQuery()
 {
     $result = microtime() - $this->startTime;
     if ($this->logger->isDebugEnabled()) {
         $this->logger->debug("query done for {$result}");
     }
 }
开发者ID:rigobertbot,项目名称:meta-player,代码行数:12,代码来源:SQLLogger.php

示例13: getFieldData

 /**
  * Extract Field data from XML input
  *
  * @param Tracker_FormElement_Field $field
  * @param SimpleXMLElement $field_change
  *
  * @return mixed
  */
 public function getFieldData(Tracker_FormElement_Field $field, SimpleXMLElement $field_change)
 {
     $values = $field_change->value;
     $files_infos = array();
     if ($this->isFieldChangeEmpty($values)) {
         $this->logger->warn('Skipped attachment field ' . $field->getLabel() . ': field value is empty.');
         return $files_infos;
     }
     foreach ($values as $value) {
         try {
             $attributes = $value->attributes();
             $file_id = (string) $attributes['ref'];
             $file = $this->files_importer->getFileXML($file_id);
             if (!$this->files_importer->fileIsAlreadyImported($file_id)) {
                 $files_infos[] = $this->getFileInfoForAttachment($file);
                 $this->files_importer->markAsImported($file_id);
             }
         } catch (Tracker_Artifact_XMLImport_Exception_FileNotFoundException $exception) {
             $this->logger->warn('Skipped attachment field ' . $field->getLabel() . ': ' . $exception->getMessage());
         }
     }
     if ($this->itCannotImportAnyFiles($values, $files_infos)) {
         throw new Tracker_Artifact_XMLImport_Exception_NoValidAttachementsException();
     }
     return $files_infos;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:34,代码来源:XMLImportFieldStrategyAttachment.class.php

示例14: sendNotice

 /**
  * Sends a notice about deprecated use of a function, view, etc.
  *
  * @param string $msg             Message to log
  * @param string $dep_version     Human-readable *release* version: 1.7, 1.8, ...
  * @param int    $backtrace_level How many levels back to display the backtrace.
  *                                Useful if calling from functions that are called
  *                                from other places (like elgg_view()). Set to -1
  *                                for a full backtrace.
  * @return bool
  */
 function sendNotice($msg, $dep_version, $backtrace_level = 1)
 {
     $msg = "Deprecated in {$dep_version}: {$msg} Called from ";
     // Get a file and line number for the log. Skip over the function that
     // sent this notice and see who called the deprecated function itself.
     $stack = array();
     $backtrace = debug_backtrace();
     // never show this call.
     array_shift($backtrace);
     $i = count($backtrace);
     foreach ($backtrace as $trace) {
         if (empty($trace['file'])) {
             // file/line not set for Closures
             $stack[] = "[#{$i}] unknown";
         } else {
             $stack[] = "[#{$i}] {$trace['file']}:{$trace['line']}";
         }
         $i--;
         if ($backtrace_level > 0) {
             if ($backtrace_level <= 1) {
                 break;
             }
             $backtrace_level--;
         }
     }
     $msg .= implode("<br /> -> ", $stack);
     $this->logger->warn($msg);
     return true;
 }
开发者ID:elgg,项目名称:elgg,代码行数:40,代码来源:DeprecationService.php

示例15: log

 /**
  * @param $message
  */
 public function log($message)
 {
     $this->doLog($message);
     if ($this->next !== null) {
         $this->next->doLog($message);
     }
 }
开发者ID:alxolr,项目名称:php-dp,代码行数:10,代码来源:ChainOfResponsibility.php


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