Ejemplo n.º 1
0
 /**
  * Construct
  *
  * @param  int                       $level
  * @param  bool                      $bubble
  * @throws ehough_epilog_handler_MissingExtensionException
  */
 public function __construct($level = ehough_epilog_Logger::DEBUG, $bubble = true)
 {
     if (!function_exists('zend_monitor_custom_event')) {
         throw new ehough_epilog_handler_MissingExtensionException('You must have Zend Server installed in order to use this handler');
     }
     parent::__construct($level, $bubble);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function setFormatter(ehough_epilog_formatter_FormatterInterface $formatter)
 {
     if ($formatter instanceof ehough_epilog_formatter_ElasticaFormatter) {
         return parent::setFormatter($formatter);
     }
     throw new InvalidArgumentException('ElasticSearchHandler is only compatible with ElasticaFormatter');
 }
Ejemplo n.º 3
0
 public function __construct($token, $level = ehough_epilog_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);
 }
Ejemplo n.º 4
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 = ehough_epilog_Logger::DEBUG, $bubble = true)
 {
     parent::__construct($level, $bubble);
     if (!$publisher instanceof Gelf\IMessagePublisher && !$publisher instanceof Gelf\PublisherInterface) {
         throw new InvalidArgumentException("Invalid publisher, expected a Gelf\\IMessagePublisher or Gelf\\PublisherInterface instance");
     }
     $this->publisher = $publisher;
 }
Ejemplo n.º 5
0
 public function __construct($mongo, $database, $collection, $level = ehough_epilog_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);
 }
Ejemplo n.º 6
0
 public function __construct($redis, $key, $level = ehough_epilog_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);
 }
Ejemplo n.º 7
0
 /**
  * @param Aws\DynamoDb\DynamoDbClient $client
  * @param string                      $table
  * @param integer                     $level
  * @param boolean                     $bubble
  */
 public function __construct(Aws\DynamoDb\DynamoDbClient $client, $table, $level = ehough_epilog_Logger::DEBUG, $bubble = true)
 {
     if (!defined('Aws\\Common\\Aws::VERSION') || version_compare('3.0', Aws\Common\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);
 }
Ejemplo n.º 8
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 = ehough_epilog_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;
 }
Ejemplo n.º 9
0
 /**
  * @param 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     $filePermissions Optional file permissions (default (0644) are only for owner read/write)
  */
 public function __construct($stream, $level = ehough_epilog_Logger::DEBUG, $bubble = true, $filePermission = null)
 {
     parent::__construct($level, $bubble);
     if (is_resource($stream)) {
         $this->stream = $stream;
     } else {
         $this->url = $stream;
     }
     $this->filePermission = $filePermission;
 }
Ejemplo n.º 10
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 = ehough_epilog_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);
 }
Ejemplo n.º 11
0
 /**
  * @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 = ehough_epilog_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;
 }
Ejemplo n.º 12
0
 public function __construct(array $options = array(), $level = ehough_epilog_Logger::DEBUG, $bubble = true)
 {
     $this->options = array_merge(array('host' => 'localhost', 'port' => 5984, 'dbname' => 'logger', 'username' => null, 'password' => null), $options);
     parent::__construct($level, $bubble);
 }
Ejemplo n.º 13
0
 public function __construct(Doctrine\CouchDB\CouchDBClient $client, $level = ehough_epilog_Logger::DEBUG, $bubble = true)
 {
     $this->client = $client;
     parent::__construct($level, $bubble);
 }
Ejemplo n.º 14
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 = ehough_epilog_Logger::ERROR, $bubble = true)
 {
     $this->rollbarNotifier = $rollbarNotifier;
     parent::__construct($level, $bubble);
 }
 public function __construct()
 {
     parent::__construct();
     $this->setFormatter(new ehough_epilog_formatter_LineFormatter("[%datetime%] [%level_name%] %channel%: %message% <br />\n"));
     $this->setLevel(ehough_epilog_Logger::DEBUG);
 }
Ejemplo n.º 16
0
 /**
  * {@inheritDoc}
  *
  * @param string $appName
  */
 public function __construct($level = ehough_epilog_Logger::ERROR, $bubble = true, $appName = null)
 {
     parent::__construct($level, $bubble);
     $this->appName = $appName;
 }
Ejemplo n.º 17
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 = ehough_epilog_Logger::DEBUG, $bubble = true)
 {
     parent::__construct($level, $bubble);
     $this->connectionString = $connectionString;
     $this->connectionTimeout = (double) ini_get('default_socket_timeout');
 }
Ejemplo n.º 18
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 = ehough_epilog_Logger::DEBUG, $bubble = true)
 {
     parent::__construct($level, $bubble);
     $this->ravenClient = $ravenClient;
 }
Ejemplo n.º 19
0
 /**
  * @param AMQPExchange $exchange     AMQP exchange, 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(AMQPExchange $exchange, $exchangeName = 'log', $level = ehough_epilog_Logger::DEBUG, $bubble = true)
 {
     $this->exchange = $exchange;
     $this->exchange->setName($exchangeName);
     parent::__construct($level, $bubble);
 }