Beispiel #1
0
 /**
  * @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;
 }
Beispiel #2
0
 public function isHandling(CM_Log_Record $record)
 {
     if (true !== $this->_newRelicService->getEnabled()) {
         return false;
     }
     if (!$record->getContext()->getException()) {
         return false;
     }
     return parent::isHandling($record);
 }
Beispiel #3
0
 /**
  * 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];
 }
Beispiel #4
0
 /**
  * @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);
 }