本文整理汇总了PHP中Zend\Log\Logger::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::info方法的具体用法?PHP Logger::info怎么用?PHP Logger::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Log\Logger
的用法示例。
在下文中一共展示了Logger::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
protected function log($log)
{
if (is_array($log)) {
$log = print_r($log, true);
}
$this->logger->info($log);
}
示例2: initProfiler
/**
* Init profiler
*/
public function initProfiler(MvcEvent $e)
{
try {
$writer = new FirePhp();
$logger = new Logger();
$logger->addWriter($writer);
$logger->info('memory usage: ' . memory_get_usage(true) / 1024 / 1024 . 'Mb');
$logger->info('page execution time: ' . (microtime(true) - APPLICATION_START));
// get sql profiler
if (null !== ($sqlProfiler = $this->serviceLocator->get('Zend\\Db\\Adapter\\Adapter')->getProfiler())) {
$queriesTotalTime = 0;
foreach ($sqlProfiler->getProfiles() as $query) {
$base = ['time' => $query['elapse'], 'query' => $query['sql']];
$queriesTotalTime += $query['elapse'];
if (!empty($query['parameters'])) {
$params = [];
foreach ($query['parameters'] as $key => $value) {
$params[$key] = $value;
}
$base['params'] = $params;
}
$logger->info('', $base);
}
$logger->info('sql queries total execution time: ' . $queriesTotalTime);
}
} catch (Exception $e) {
ApplicationErrorLogger::log($e);
}
}
示例3: info
/**
* Log de info
* @param string $pathLog caminho do erro
* @param string $message mensagem de erro
* @return boolean
*/
public static function info($pathLog, $message)
{
self::createLogger();
self::$logger->addWriter(new \Zend\Log\Writer\Stream($pathLog . DIRECTORY_SEPARATOR . "info.log"));
self::$logger->info($message);
self::destroyLogger();
return TRUE;
}
示例4: stopQuery
public function stopQuery()
{
if ($this->enabled) {
parent::stopQuery();
$q = $this->queries[$this->currentQuery];
$message = "Executed Query: " . print_r($q, true);
$this->logger->info($message);
}
}
示例5: testSetSubjectPrependText
public function testSetSubjectPrependText()
{
$this->writer->setSubjectPrependText('test');
$this->log->info('an info message');
$this->log->info('a second info message');
unset($this->log);
$contents = file_get_contents(__DIR__ . '/' . self::FILENAME);
$this->assertContains('an info message', $contents);
$this->assertContains('Subject: test', $contents);
}
示例6: logMessage
/**
* Log a message
*
* @param string $message Message to be logged
*/
public function logMessage($message)
{
$this->logger->info(strip_tags($message));
if ($this->sendToBrowser) {
$this->sendMessageToBrowser($message);
}
if ($this->sendToCli) {
$this->sendMessageToCli($message);
}
}
示例7: logIssues
/**
* @return bool
*/
private function logIssues()
{
if (!$this->isVerbose()) {
return false;
}
$form = $this->userService->getRegisterForm();
foreach ($form->getMessages() as $key => $messages) {
foreach ($messages as $issueKey => $issueMessage) {
$this->logger->info($key . '/' . $issueKey . ': ' . $issueMessage);
}
}
return true;
}
示例8: run
public function run(Command $cmd)
{
$command = $this->bin . ' ' . (string) $cmd;
$this->logger->debug('Command : `' . $command . '``');
$proc = popen((string) $command, 'r');
while (($line = fgets($proc)) !== false) {
foreach ($this->handler as $handler) {
$handler->handle($line, $this, $cmd);
}
}
$this->logger->info('Done.');
/** @var HandlerInterface[] $handlers */
return array_merge($this->handler, $this->ignoredHandler);
}
示例9: showAction
public function showAction()
{
$url = $this->getEvent()->getRouteMatch()->getParam('url');
$this->logger->info('Preparing scan for `' . $url . '`');
$client = $this->client;
$client->addHandler(new UrlHandler());
$client->addHandler(new PluginHandler());
$client->addHandler(new TemplateHandler());
$command = new Command();
$command->addArgs(new Url($url));
$command->addArgs(new FakeUserAgent());
$result = $client->run($command);
foreach ($result as $handler) {
$this->console->writeLine($handler->__toString());
}
}
示例10: onMailSent
/**
* Callback function invoking on successful mail sent
*
* @param Event $e
*/
public function onMailSent(Event $e)
{
/* @var Message */
$message = $e->getTarget();
$addressList = $this->prepareAddressList($message);
$this->logger->info(sprintf("E-mail '%s' has been sent to following recipients: %s", $message->getSubject(), implode(', ', $addressList)));
}
示例11: console
/**
* console($text, $exception = false, $exit = false) Output console message
* @param string $data stdout data
* @param boolean $exception throwed Eception
* @param boolean $exit die console out
* @acceess public
*/
public function console($data, $exception = false, $exit = false)
{
// check if console is usable
if (true === $this->config['debug']) {
if (is_array($data) || is_object($data)) {
Debug::dump($data . '', date('[Y-m-d H:i:s]') . ' [DEBUG]');
if (isset($this->__log)) {
$this->_logger->info($data);
}
} else {
if (!is_resource($data)) {
$data = mb_convert_encoding($data, $this->config['encoding']);
}
$text = date('[Y-m-d H:i:s]') . '[DEBUG] ' . $data . "\r\n";
if ($exception) {
if ($this->__log) {
$this->_logger->crit($text);
}
throw new Exception\ExceptionStrategy($text);
} else {
if ($this->__log) {
$this->_logger->info($text);
}
echo $text;
}
}
if ($exit) {
$this->shutdown();
}
}
}
示例12: closeSentMessage
/**
* @param Message $message
*
* @return bool
*/
private function closeSentMessage(Message $message)
{
$queue = $message->getQueue();
if (empty($queue)) {
return false;
}
$allSent = true;
foreach ($queue as $queueItem) {
if (null === $queueItem->getSentAt()) {
$allSent = false;
break;
}
}
if ($this->isVerbose()) {
$messageAsString = $this->messageToString($message, count($queue));
if ($allSent) {
$this->logger->info('Message to be closed: ' . $messageAsString);
} else {
$this->logger->info('Message is still being sent: ' . $messageAsString);
}
}
if ($allSent) {
$this->messageRepository->closeMessage($message);
return true;
}
return false;
}
示例13: transactionReceived
public function transactionReceived(string $address, float $amount)
{
$this->logger->notice("Received transaction to address {$address}");
$stmt = $this->connection->prepare('UPDATE addresses SET last_used = NULL WHERE address = :address');
$stmt->execute([':address' => $address]);
$addressMaxAge = new \DateTime($this->addressLockTime);
$stmt = $this->connection->prepare('SELECT id, ordered_genre_id, price FROM orders WHERE address = :address AND ordered > :maxAge AND paid = FALSE');
$stmt->execute([':address' => $address, ':maxAge' => $addressMaxAge->format("Y-m-d H:i:s")]);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$orderId = $result['id'];
$orderedGenreId = $result['ordered_genre_id'];
$price = $result['price'];
if ($price > $amount) {
//if paid amount is smaller than ordered price
return;
}
$stmt = $this->connection->prepare('UPDATE orders SET paid = TRUE WHERE address = :address AND ordered > :maxAge AND paid = FALSE');
$stmt->execute([':address' => $address, ':maxAge' => $addressMaxAge->format("Y-m-d H:i:s")]);
if ($orderedGenreId != null) {
file_put_contents($this->currentGenreFile, $orderedGenreId);
}
$this->logger->info("{$orderId} has been paid");
$stmt = $this->connection->prepare('UPDATE queue SET paid = TRUE WHERE order_id = :id');
$stmt->execute([':id' => $orderId]);
}
示例14: logInfo
/**
*
* @param string $message
* @param array $extra
*/
public static function logInfo($message, array $extra = array())
{
if (is_null(self::$logger)) {
throw new ProcessException("Impossible de loguer le message d'information : " . $message);
} else {
self::$logger->info($message, $extra);
}
}
示例15: perform
public function perform()
{
$queueName = isset($this->args['name']) ? $this->args['name'] : 'error';
$writer = new Log\Writer\Stream(EVA_PUBLIC_PATH . '/logs/' . $queueName . '.log');
$logger = new Log\Logger();
$logger->addWriter($writer);
$logger->info("Worker {$queueName} is working");
}