/**
  * Construct
  *
  * @param  int                       $level
  * @param  bool                      $bubble
  * @throws MissingExtensionException
  */
 public function __construct($level = Logger::DEBUG, $bubble = true)
 {
     if (!function_exists('zend_monitor_custom_event')) {
         throw new MissingExtensionException('You must have Zend Server installed in order to use this handler');
     }
     parent::__construct($level, $bubble);
 }
 /**
  * {@inheritdoc}
  */
 public function setFormatter(FormatterInterface $formatter)
 {
     if ($formatter instanceof ElasticaFormatter) {
         return parent::setFormatter($formatter);
     }
     throw new \InvalidArgumentException('ElasticSearchHandler is only compatible with ElasticaFormatter');
 }
 /**
  * @param integer $level  The minimum logging level at which this handler will be triggered
  * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct($level = Logger::DEBUG, $bubble = true)
 {
     parent::__construct($level, $bubble);
     if (!function_exists('json_encode')) {
         throw new \RuntimeException('PHP\'s json extension is required to use Yafrk\\JPush\\Monolog\'s ChromePHPHandler');
     }
 }
Example #4
0
 public function __construct($token, $level = Logger::DEBUG, $bubble = true)
 {
     if (!extension_loaded('curl')) {
         throw new \LogicException('The curl extension is needed to use the LogglyHandler');
     }
     $this->token = $token;
     parent::__construct($level, $bubble);
 }
Example #5
0
 public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true)
 {
     if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
         throw new \InvalidArgumentException('MongoClient or Mongo instance required');
     }
     $this->mongoCollection = $mongo->selectCollection($database, $collection);
     parent::__construct($level, $bubble);
 }
Example #6
0
 /**
  * @param PublisherInterface|IMessagePublisher $publisher a publisher object
  * @param integer                              $level     The minimum logging level at which this handler will be triggered
  * @param boolean                              $bubble    Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct($publisher, $level = Logger::DEBUG, $bubble = true)
 {
     parent::__construct($level, $bubble);
     if (!$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) {
         throw new InvalidArgumentException("Invalid publisher, expected a Gelf\\IMessagePublisher or Gelf\\PublisherInterface instance");
     }
     $this->publisher = $publisher;
 }
Example #7
0
 public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true)
 {
     if (!($redis instanceof \Predis\Client || $redis instanceof \Redis)) {
         throw new \InvalidArgumentException('Predis\\Client or Redis instance required');
     }
     $this->redisClient = $redis;
     $this->redisKey = $key;
     parent::__construct($level, $bubble);
 }
Example #8
0
 /**
  * @param DynamoDbClient $client
  * @param string         $table
  * @param integer        $level
  * @param boolean        $bubble
  */
 public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
 {
     if (!defined('Aws\\Yafrk\\Aws::VERSION') || version_compare('3.0', Aws::VERSION, '<=')) {
         throw new \RuntimeException('The DynamoDbHandler is only known to work with the AWS SDK 2.x releases');
     }
     $this->client = $client;
     $this->table = $table;
     parent::__construct($level, $bubble);
 }
Example #9
0
 /**
  * @param integer $messageType    Says where the error should go.
  * @param integer $level          The minimum logging level at which this handler will be triggered
  * @param Boolean $bubble         Whether the messages that are handled can bubble up the stack or not
  * @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
  */
 public function __construct($messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, $bubble = true, $expandNewlines = false)
 {
     parent::__construct($level, $bubble);
     if (false === in_array($messageType, self::getAvailableTypes())) {
         $message = sprintf('The given message type "%s" is not supported', print_r($messageType, true));
         throw new \InvalidArgumentException($message);
     }
     $this->messageType = $messageType;
     $this->expandNewlines = $expandNewlines;
 }
Example #10
0
 /**
  * @param AMQPExchange|AMQPChannel $exchange     AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use
  * @param string                   $exchangeName
  * @param int                      $level
  * @param bool                     $bubble       Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct($exchange, $exchangeName = 'log', $level = Logger::DEBUG, $bubble = true)
 {
     if ($exchange instanceof AMQPExchange) {
         $exchange->setName($exchangeName);
     } elseif ($exchange instanceof AMQPChannel) {
         $this->exchangeName = $exchangeName;
     } else {
         throw new \InvalidArgumentException('PhpAmqpLib\\Channel\\AMQPChannel or AMQPExchange instance required');
     }
     $this->exchange = $exchange;
     parent::__construct($level, $bubble);
 }
Example #11
0
 /**
  * @param resource|string $stream
  * @param integer         $level          The minimum logging level at which this handler will be triggered
  * @param Boolean         $bubble         Whether the messages that are handled can bubble up the stack or not
  * @param int|null        $filePermission Optional file permissions (default (0644) are only for owner read/write)
  * @param Boolean         $useLocking     Try to lock log file before doing any writes
  *
  * @throws InvalidArgumentException If stream is not a resource or string
  */
 public function __construct($stream, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false)
 {
     parent::__construct($level, $bubble);
     if (is_resource($stream)) {
         $this->stream = $stream;
     } elseif (is_string($stream)) {
         $this->url = $stream;
     } else {
         throw new \InvalidArgumentException('A stream must either be a resource or a string.');
     }
     $this->filePermission = $filePermission;
     $this->useLocking = $useLocking;
 }
Example #12
0
 /**
  * Create a Cube handler
  *
  * @throws UnexpectedValueException when given url is not a valid url.
  *                                  A valid url must consists of three parts : protocol://host:port
  *                                  Only valid protocol used by Cube are http and udp
  */
 public function __construct($url, $level = Logger::DEBUG, $bubble = true)
 {
     $urlInfos = parse_url($url);
     if (!isset($urlInfos['scheme']) || !isset($urlInfos['host']) || !isset($urlInfos['port'])) {
         throw new \UnexpectedValueException('URL "' . $url . '" is not valid');
     }
     if (!in_array($urlInfos['scheme'], $this->acceptedSchemes)) {
         throw new \UnexpectedValueException('Invalid protocol (' . $urlInfos['scheme'] . ').' . ' Valid options are ' . implode(', ', $this->acceptedSchemes));
     }
     $this->scheme = $urlInfos['scheme'];
     $this->host = $urlInfos['host'];
     $this->port = $urlInfos['port'];
     parent::__construct($level, $bubble);
 }
 /**
  * @param mixed   $facility
  * @param integer $level    The minimum logging level at which this handler will be triggered
  * @param Boolean $bubble   Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)
 {
     parent::__construct($level, $bubble);
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         $this->facilities['local0'] = LOG_LOCAL0;
         $this->facilities['local1'] = LOG_LOCAL1;
         $this->facilities['local2'] = LOG_LOCAL2;
         $this->facilities['local3'] = LOG_LOCAL3;
         $this->facilities['local4'] = LOG_LOCAL4;
         $this->facilities['local5'] = LOG_LOCAL5;
         $this->facilities['local6'] = LOG_LOCAL6;
         $this->facilities['local7'] = LOG_LOCAL7;
     }
     // convert textual description of facility to syslog constant
     if (array_key_exists(strtolower($facility), $this->facilities)) {
         $facility = $this->facilities[strtolower($facility)];
     } elseif (!in_array($facility, array_values($this->facilities), true)) {
         throw new \UnexpectedValueException('Unknown facility value "' . $facility . '" given');
     }
     $this->facility = $facility;
 }
Example #14
0
 public function __construct(array $options = array(), $level = Logger::DEBUG, $bubble = true)
 {
     $this->options = array_merge(array('host' => 'localhost', 'port' => 5984, 'dbname' => 'logger', 'username' => null, 'password' => null), $options);
     parent::__construct($level, $bubble);
 }
Example #15
0
 /**
  * @param string  $connectionString Socket connection string
  * @param integer $level            The minimum logging level at which this handler will be triggered
  * @param Boolean $bubble           Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true)
 {
     parent::__construct($level, $bubble);
     $this->connectionString = $connectionString;
     $this->connectionTimeout = (double) ini_get('default_socket_timeout');
 }
Example #16
0
 /**
  * {@inheritDoc}
  *
  * @param string $appName
  */
 public function __construct($level = Logger::ERROR, $bubble = true, $appName = null)
 {
     parent::__construct($level, $bubble);
     $this->appName = $appName;
 }
Example #17
0
 /**
  * @param Raven_Client $ravenClient
  * @param integer      $level       The minimum logging level at which this handler will be triggered
  * @param Boolean      $bubble      Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true)
 {
     parent::__construct($level, $bubble);
     $this->ravenClient = $ravenClient;
 }
Example #18
0
 /**
  * @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token
  * @param integer         $level           The minimum logging level at which this handler will be triggered
  * @param boolean         $bubble          Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true)
 {
     $this->rollbarNotifier = $rollbarNotifier;
     parent::__construct($level, $bubble);
 }