示例#1
0
文件: Fluentd.php 项目: cargomedia/cm
 /**
  * @param FluentLogger                      $fluentdLogger
  * @param CM_Log_ContextFormatter_Interface $contextFormatter
  * @param string                            $tag
  * @param int|null                          $minLevel
  */
 public function __construct(FluentLogger $fluentdLogger, CM_Log_ContextFormatter_Interface $contextFormatter, $tag, $minLevel = null)
 {
     parent::__construct($minLevel);
     $this->_fluentdLogger = $fluentdLogger;
     $this->_contextFormatter = $contextFormatter;
     $this->_tag = (string) $tag;
 }
示例#2
0
文件: Handler.php 项目: cargomedia/cm
 public function isHandling(CM_Log_Record $record)
 {
     if (true !== $this->_newRelicService->getEnabled()) {
         return false;
     }
     if (!$record->getContext()->getException()) {
         return false;
     }
     return parent::isHandling($record);
 }
示例#3
0
文件: MongoDb.php 项目: cargomedia/cm
 /**
  * CM_Log_Handler_MongoDb constructor.
  * @param CM_MongoDb_Client      $client
  * @param CM_Log_Encoder_MongoDb $encoder
  * @param string                 $collection
  * @param int|null               $recordTtl Time To Live in seconds
  * @param array|null             $insertOptions
  * @param int|null               $minLevel
  * @throws CM_Exception_Invalid
  */
 public function __construct(CM_MongoDb_Client $client, CM_Log_Encoder_MongoDb $encoder, $collection, $recordTtl = null, array $insertOptions = null, $minLevel = null)
 {
     parent::__construct($minLevel);
     $this->_collection = (string) $collection;
     $this->_encoder = $encoder;
     $this->_mongoDb = $client;
     if (null !== $recordTtl) {
         $this->_recordTtl = (int) $recordTtl;
         if ($this->_recordTtl <= 0) {
             throw new CM_Exception_Invalid('TTL should be positive value');
         }
     }
     $this->_insertOptions = null !== $insertOptions ? $insertOptions : ['w' => 0];
 }
示例#4
0
文件: Stream.php 项目: cargomedia/cm
 /**
  * @param CM_OutputStream_Interface  $stream
  * @param CM_Log_Formatter_Interface $formatter
  * @param int|null                   $minLevel
  */
 public function __construct(CM_OutputStream_Interface $stream, CM_Log_Formatter_Interface $formatter, $minLevel = null)
 {
     $this->_stream = $stream;
     $this->_formatter = $formatter;
     parent::__construct($minLevel);
 }