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


PHP Logger::info方法代码示例

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


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

示例1: consume

 /**
  * @param $channel
  * @param $message
  */
 public function consume($channel, $message)
 {
     $this->logger->info('consuming message');
     if ($channel == 'saveInBulk') {
         $this->service->saveInBulk($message);
     }
 }
开发者ID:luizfk,项目名称:pipedrive-test-task,代码行数:11,代码来源:Consumer.php

示例2: findJob

 /**
  * Find the next job that should be executed.
  * By default, just selects any job instance that is in the database that isn't
  * already executing, hasn't already been finished, and hasn't errored out.
  * @return a job array (id, job_type, [user_id], [arg_id]) or {@code false} if there is none
  */
 function findJob(Connection $db, Logger $logger)
 {
     // TODO timeout jobs
     // mark all repeatedly failing jobs as failing
     $execution_limit = Config::get("job_execution_limit", 5);
     $q = $db->prepare("SELECT * FROM jobs WHERE is_executed=0 AND is_executing=0 AND execution_count >= ?");
     $q->execute(array($execution_limit));
     if ($failed = $q->fetchAll()) {
         $logger->info("Found " . number_format(count($failed)) . " jobs that have executed too many times ({$execution_limit})");
         foreach ($failed as $f) {
             $q = $db->prepare("UPDATE jobs SET is_executed=1,is_error=1 WHERE id=?");
             $q->execute(array($f['id']));
             $logger->info("Marked job " . $f['id'] . " as failed");
         }
     }
     // find first a job that has zero execution count
     $q = $db->prepare("SELECT * FROM jobs WHERE " . $this->defaultFindJobQuery() . " AND execution_count=0 LIMIT 1");
     $q->execute();
     if ($job = $q->fetch()) {
         return $job;
     }
     // or, any job
     $q = $db->prepare("SELECT * FROM jobs WHERE " . $this->defaultFindJobQuery() . " LIMIT 1");
     $q->execute();
     return $q->fetch();
 }
开发者ID:openclerk,项目名称:jobs,代码行数:32,代码来源:JobRunner.php

示例3: notify

 public function notify(Service\Record $record, DOMDocument $config, Logger $logger)
 {
     $activity = $config->getElementsByTagName('activity')->item(0);
     if ($activity !== null) {
         $logger->info('Create user activity template');
         try {
             $templates = $activity->childNodes;
             for ($i = 0; $i < $templates->length; $i++) {
                 $template = $templates->item($i);
                 if (!$template instanceof DOMElement) {
                     continue;
                 }
                 if ($template->nodeName == 'template') {
                     $type = $template->getAttribute('type');
                     $verb = $template->getAttribute('verb');
                     $table = $template->getAttribute('table');
                     $path = $template->getAttribute('path');
                     $summary = $template->nodeValue;
                     if (isset($this->registry['table.' . $table])) {
                         $table = $this->registry['table.' . $table];
                     } else {
                         throw new Exception('Invalid table ' . $table);
                     }
                     if (!empty($type) && !empty($verb) && !empty($table) && !empty($summary)) {
                         $this->sql->insert($this->registry['table.user_activity_template'], array('type' => $type, 'verb' => $verb, 'table' => $table, 'path' => $path, 'summary' => $summary));
                         $logger->info('> Created user activity template');
                         $logger->info($summary);
                     }
                 }
             }
         } catch (\Exception $e) {
             $logger->error($e->getMessage());
         }
     }
 }
开发者ID:visapi,项目名称:amun,代码行数:35,代码来源:ConfigListener.php

示例4: storeMarkets

 function storeMarkets($markets, Logger $logger)
 {
     $logger->info("Storing " . count($markets) . " markets persistently");
     // find all existing markets
     $existing = $this->getMarkets(true);
     // remove removed markets
     foreach ($existing as $pair) {
         if (array_search($pair, $markets) === false) {
             $logger->info("Removing pair " . implode("/", $pair));
             $q = $this->db->prepare("DELETE FROM exchange_pairs WHERE exchange=? AND currency1=? AND currency2=?");
             $q->execute(array($this->exchange->getCode(), $pair[0], $pair[1]));
         }
     }
     // add new markets
     foreach ($markets as $pair) {
         if (array_search($pair, $existing) === false) {
             if (strlen($pair[0]) != 3) {
                 $logger->info("Ignoring currency '" . $pair[0] . "': not three characters long");
                 continue;
             }
             if (strlen($pair[1]) != 3) {
                 $logger->info("Ignoring currency '" . $pair[1] . "': not three characters long");
                 continue;
             }
             $logger->info("Adding pair " . implode("/", $pair));
             $q = $this->db->prepare("INSERT INTO exchange_pairs SET exchange=?, currency1=?, currency2=?");
             $q->execute(array($this->exchange->getCode(), $pair[0], $pair[1]));
         }
     }
     // reset cache
     $this->cached_markets = null;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:32,代码来源:PersistentExchange.php

示例5: itShouldCollect

 /**
  * @test
  */
 public function itShouldCollect()
 {
     $this->serializer->normalize(Argument::any())->shouldBeCalled()->willReturn([]);
     $this->logger->pushHandler(Argument::any())->shouldBeCalled()->willReturn(true);
     $this->logger->info(Argument::type('string'), Argument::type('array'))->shouldBeCalled();
     $this->collector->collect($this->requestObject, ['logFile' => 'test.log']);
 }
开发者ID:deuzu,项目名称:request-collector-bundle,代码行数:10,代码来源:LoggerCollectorTest.php

示例6: delFileTree

 /**
  * Remove a directory and its contents recursively. Use with caution. 
  */
 private function delFileTree($path, $force = false)
 {
     if (!file_exists($path)) {
         return;
     }
     if (!is_dir($path)) {
         $this->logger->info("f: {$path}");
         if (file_exists($path) && $force === true) {
             unlink($path);
         }
         return;
     }
     $directoryIterator = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS);
     $fileIterator = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST);
     foreach ($fileIterator as $file) {
         if ($file->isDir()) {
             $this->logger->info("d: {$file->getRealPath()}");
             if ($force === true) {
                 rmdir($file->getRealPath());
             }
         } else {
             $this->logger->info("f: {$file->getRealPath()}");
             if ($force === true) {
                 unlink($file->getRealPath());
             }
         }
     }
     $this->logger->info("d: {$file->getRealPath()}");
     if ($force === true) {
         rmdir($path);
     }
 }
开发者ID:ubermichael,项目名称:pkppln-php,代码行数:35,代码来源:CleanupCommand.php

示例7: fetchAllRates

 function fetchAllRates(Logger $logger)
 {
     $url = "https://api.vircurex.com/api/get_info_for_currency.json";
     $logger->info($url);
     $json = Fetch::jsonDecode(Fetch::get($url));
     $result = array();
     $ignored = 0;
     foreach ($json as $pair2 => $pairs) {
         if ($pair2 == "status") {
             continue;
         }
         foreach ($pairs as $pair1 => $market) {
             if ($market['last_trade'] == 0 || $market['lowest_ask'] == 0 || $market['highest_bid'] == 0) {
                 // ignore empty markets
                 $ignored++;
                 continue;
             }
             $currency1 = $this->getCurrencyCode($pair1);
             $currency2 = $this->getCurrencyCode($pair2);
             if (CurrencyOrder::hasOrder($currency1) && CurrencyOrder::hasOrder($currency2)) {
                 if (!CurrencyOrder::isOrdered($currency1, $currency2)) {
                     // do not duplicate ordered currencies
                     continue;
                 }
             }
             $rate = array("currency1" => $currency1, "currency2" => $currency2, "last_trade" => $market['last_trade'], "volume" => $market['volume'], 'bid' => $market['highest_bid'], 'ask' => $market['lowest_ask']);
             $result[] = $rate;
         }
     }
     $logger->info("Ignored " . $ignored . " markets with last trade price of 0");
     return $result;
 }
开发者ID:openclerk,项目名称:exchanges,代码行数:32,代码来源:Vircurex.php

示例8: storeSupportedCurrencies

 function storeSupportedCurrencies($currencies, Logger $logger)
 {
     $logger->info("Storing " . count($currencies) . " currencies persistently");
     // find all existing currencies
     $existing = $this->getSupportedCurrencies(true);
     // remove removed currencies
     foreach ($existing as $currency) {
         if (array_search($currency, $currencies) === false) {
             $logger->info("Removing currency {$currency}");
             $q = $this->db->prepare("DELETE FROM account_currencies WHERE exchange=? AND currency=?");
             $q->execute(array($this->exchange->getCode(), $currency));
         }
     }
     // add new currencies
     foreach ($currencies as $currency) {
         if (array_search($currency, $existing) === false) {
             if (strlen($currency) != 3) {
                 $logger->info("Ignoring currency '" . $currency . "': not three characters long");
                 continue;
             }
             $logger->info("Adding currency {$currency}");
             $q = $this->db->prepare("INSERT INTO account_currencies SET exchange=?, currency=?");
             $q->execute(array($this->exchange->getCode(), $currency));
         }
     }
     // reset cache
     $this->cached_currencies = null;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:28,代码来源:PersistentAccountType.php

示例9: fetchAllRates

 function fetchAllRates(Logger $logger)
 {
     $params = $this->generatePostData("getmarkets");
     $url = "https://www.cryptsy.com/api";
     $logger->info($url);
     $raw = Fetch::post($url, $params['post'], array(), $params['headers']);
     $json = Fetch::jsonDecode($raw);
     if (!$json['success']) {
         throw new ExchangeRateException($json['error']);
     }
     $result = array();
     foreach ($json['return'] as $market) {
         $key = $market['label'];
         if ($market['last_trade'] == 0) {
             $logger->info("Ignoring '{$key}' market: last trade price is 0");
             continue;
         }
         $currency1 = $this->getCurrencyCode($market['secondary_currency_code']);
         $currency2 = $this->getCurrencyCode($market['primary_currency_code']);
         $rate = array("currency1" => $currency1, "currency2" => $currency2, "last_trade" => $market['last_trade'], "volume" => $market['current_volume'], 'low' => $market['low_trade'], 'high' => $market['high_trade']);
         if ($this->shouldSwitch($currency1, $currency2)) {
             $rate = array('currency1' => $rate['currency2'], 'currency2' => $rate['currency1'], 'last_trade' => 1 / $rate['last_trade'], 'volume' => $rate['volume'] / $rate['last_trade'], 'low' => $rate['high'] == 0 ? 0 : 1 / $rate['high'], 'high' => $rate['low'] == 0 ? 0 : 1 / $rate['low']);
         }
         $result[] = $rate;
     }
     return $result;
 }
开发者ID:openclerk,项目名称:exchanges,代码行数:27,代码来源:Cryptsy.php

示例10: fetchAllRates

 function fetchAllRates(Logger $logger)
 {
     $url = "https://www.coins-e.com/api/v2/markets/data/";
     $logger->info($url);
     $json = Fetch::jsonDecode(Fetch::get($url));
     $result = array();
     $retired = 0;
     foreach ($json as $key => $market) {
         if ($market['status'] == 'retired') {
             $retired++;
             continue;
         }
         if ($market['marketstat']['ltp'] == 0) {
             $logger->info("Ignoring '{$key}' market: last trade price is 0");
             continue;
         }
         $pairs = explode("_", $key, 2);
         $currency1 = $this->getCurrencyCode($pairs[0]);
         $currency2 = $this->getCurrencyCode($pairs[1]);
         $rate = array("currency1" => $currency2, "currency2" => $currency1, "last_trade" => $market['marketstat']['ltp'], "bid" => $market['marketstat']['bid'], "ask" => $market['marketstat']['ask'], "volume" => $market['marketstat']['24h']['volume'], "high" => $market['marketstat']['24h']['h'], "low" => $market['marketstat']['24h']['l'], "avg" => $market['marketstat']['24h']['avg_rate']);
         $result[] = $rate;
     }
     $logger->info("Ignored {$retired} retired markets");
     return $result;
 }
开发者ID:openclerk,项目名称:exchanges,代码行数:25,代码来源:CoinsE.php

示例11: notify

 public function notify(Service\Record $record, DOMDocument $config, Logger $logger)
 {
     $api = $config->getElementsByTagName('api')->item(0);
     if ($api !== null) {
         $logger->info('Create api');
         try {
             $services = $api->childNodes;
             for ($i = 0; $i < $services->length; $i++) {
                 $service = $services->item($i);
                 if (!$service instanceof DOMElement) {
                     continue;
                 }
                 if ($service->nodeName == 'service') {
                     $types = $service->getElementsByTagName('type');
                     $uri = $service->getElementsByTagName('uri')->item(0);
                     if ($uri instanceof DOMElement) {
                         $endpoint = rtrim($record->path . $uri->nodeValue, '/');
                         $this->sql->insert($this->registry['table.xrds'], array('serviceId' => $record->id, 'priority' => 0, 'endpoint' => $endpoint));
                         $apiId = $this->sql->getLastInsertId();
                         foreach ($types as $type) {
                             $this->sql->insert($this->registry['table.xrds_type'], array('apiId' => $apiId, 'type' => $type->nodeValue));
                         }
                         $logger->info('> Register endpoint ' . $endpoint);
                     }
                 }
             }
         } catch (\Exception $e) {
             $logger->error($e->getMessage());
         }
     }
 }
开发者ID:visapi,项目名称:amun,代码行数:31,代码来源:ConfigListener.php

示例12: testLogsToDatabase

 public function testLogsToDatabase()
 {
     $this->logger->info('some information');
     $log = $this->pdo->query('SELECT * FROM logs')->fetch();
     $this->assertNotEmpty($log);
     $this->assertTrue(isset($log['message']));
     $this->assertEquals('some information', $log['message']);
 }
开发者ID:kafene,项目名称:monolog-pdo-handler,代码行数:8,代码来源:PdoHandlerTest.php

示例13: getDifficulty

 /**
  *
  * @throws {@link DifficultyException} if something happened and the balance could not be obtained.
  */
 function getDifficulty(Logger $logger)
 {
     $url = $this->difficulty_url;
     $logger->info($url);
     $value = Fetch::get($url);
     $logger->info("Difficulty: " . number_format($value));
     return $value;
 }
开发者ID:openclerk,项目名称:cryptocurrencies,代码行数:12,代码来源:AbstractChainzService.php

示例14: execute

 /**
  * Execute command
  *
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  *
  * @return int
  *
  * @throws \Exception
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->logger->info('Execute start command');
     $isSuccessfull = $this->taskRunner->run($output);
     $exitCode = $isSuccessfull ? 0 : -1;
     $this->logger->info('Start command leave with exit code ' . $exitCode);
     return $exitCode;
 }
开发者ID:remy-theroux,项目名称:quality-checker,代码行数:18,代码来源:StartCommand.php

示例15: processMessage

 protected function processMessage(QueueMessage $message)
 {
     $msg = null;
     if (isset($message->getBody()->Message)) {
         $msg = json_decode($message->getBody()->Message);
     }
     $this->logger->debug("Processing kill message", ['message' => $msg]);
     if ($msg != null) {
         $jobId = $msg->jobId;
         /** @var Job $job */
         $job = $this->elasticsearch->getJob($jobId);
         if (!is_null($job)) {
             if ($job->getProcess()['host'] == gethostname()) {
                 if ($job->getStatus() == Job::STATUS_WAITING) {
                     $job->setStatus(Job::STATUS_CANCELLED);
                     $job->setResult(['message' => 'Job cancelled by user']);
                     $this->getComponentJobMapper($job->getComponent())->update($job);
                     $this->logger->info("receive-kill: Job '{$jobId}' cancelled", ['job' => $job->getData()]);
                     $this->requeue($job->getId());
                 } else {
                     if ($job->getStatus() == Job::STATUS_PROCESSING) {
                         $job->setStatus(Job::STATUS_TERMINATING);
                         $this->getComponentJobMapper($job->getComponent())->update($job);
                         $pid = $job->getProcess()['pid'];
                         // kill child processes
                         $process = new Process('
                         function getcpid() {
                                     cpids=`pgrep -P $1|xargs`
                             for cpid in $cpids;
                             do
                                 echo "$cpid"
                                 getcpid $cpid
                             done
                         }
                         getcpid ' . $pid);
                         $process->run();
                         $processes = $process->getOutput();
                         if ($processes && count(explode("\n", $processes))) {
                             foreach (explode("\n", $processes) as $child) {
                                 if ($child != '') {
                                     (new Process("sudo kill -KILL {$child}"))->run();
                                 }
                             }
                         }
                         // kill parent process
                         posix_kill($pid, SIGKILL);
                         $this->logger->info("receive-kill: Job '{$jobId}' killed", ['job' => $job->getData()]);
                     } else {
                         $this->logger->info("receive-kill: Job is not in waiting or processing state", ['job' => $job->getData()]);
                     }
                 }
             }
         }
     } else {
         $this->logger->warn("Corrupted message received", ['message' => $message]);
     }
     $this->queue->deleteMessage($message);
 }
开发者ID:keboola,项目名称:syrup-queue,代码行数:58,代码来源:ReceiveKillCommand.php


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