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


PHP LoggerInterface::get方法代码示例

本文整理汇总了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)]);
 }
开发者ID:dropdog,项目名称:play,代码行数:15,代码来源:ReportWorkerBase.php

示例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);
 }
开发者ID:318io,项目名称:318-io,代码行数:17,代码来源:ControllerBase.php


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