本文整理汇总了PHP中Psr\Log\LoggerInterface::get方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerInterface::get方法的具体用法?PHP LoggerInterface::get怎么用?PHP LoggerInterface::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psr\Log\LoggerInterface
的用法示例。
在下文中一共展示了LoggerInterface::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reportWork
/**
* Simple reporter log and display information about the queue.
*
* @param int $worker
* Worker number.
* @param object $item
* The $item which was stored in the cron queue.
*/
protected function reportWork($worker, $item)
{
if ($this->state->get('cron_example_show_status_message')) {
drupal_set_message($this->t('Queue @worker worker processed item with sequence @sequence created at @time', ['@worker' => $worker, '@sequence' => $item->sequence, '@time' => date_iso8601($item->created)]));
}
$this->logger->get('cron_example')->info('Queue @worker worker processed item with sequence @sequence created at @time', ['@worker' => $worker, '@sequence' => $item->sequence, '@time' => date_iso8601($item->created)]);
}
示例2: getLogger
/**
* Returns a channel logger object.
*
* @param string $channel
* The name of the channel. Can be any string, but the general practice is
* to use the name of the subsystem calling this.
*
* @return \Psr\Log\LoggerInterface
* The logger for this channel.
*/
protected function getLogger($channel)
{
if (!$this->loggerFactory) {
$this->loggerFactory = $this->container()->get('logger.factory');
}
return $this->loggerFactory->get($channel);
}