/**
  * Adds new logging channel to the registry
  *
  * @param  Logger                    $logger    Instance of the logging channel
  * @param  string|null               $name      Name of the logging channel ($logger->getName() by default)
  * @param  boolean                   $overwrite Overwrite instance in the registry if the given name already exists?
  * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists
  */
 public static function addLogger(Logger $logger, $name = null, $overwrite = false)
 {
     $name = $name ?: $logger->getName();
     if (isset(self::$loggers[$name]) && !$overwrite) {
         throw new InvalidArgumentException('Logger with the given name already exists');
     }
     self::$loggers[$name] = $logger;
 }
 /**
  * @param string       $token             Pushover api token
  * @param string|array $users             Pushover user id or array of ids the message will be sent to
  * @param string       $title             Title sent to the Pushover API
  * @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      $useSSL            Whether to connect via SSL. Required when pushing messages to users that are not
  *                                        the pushover.net app owner. OpenSSL is required for this option.
  * @param integer      $highPriorityLevel The minimum logging level at which this handler will start
  *                                        sending "high priority" requests to the Pushover API
  * @param integer      $emergencyLevel    The minimum logging level at which this handler will start
  *                                        sending "emergency" requests to the Pushover API
  * @param integer      $retry             The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user.
  * @param integer      $expire            The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds).
  */
 public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200)
 {
     $connectionString = $useSSL ? 'ssl://api.pushover.net:443' : 'api.pushover.net:80';
     parent::__construct($connectionString, $level, $bubble);
     $this->token = $token;
     $this->users = (array) $users;
     $this->title = $title ?: gethostname();
     $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel);
     $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel);
     $this->retry = $retry;
     $this->expire = $expire;
 }
 /**
  * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
  * @param int       $maxLevel       Maximum level to accept, only used if $minLevelOrList is not an array
  */
 public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY)
 {
     if (is_array($minLevelOrList)) {
         $acceptedLevels = array_map('Monolog\\Logger::toMonologLevel', $minLevelOrList);
     } else {
         $minLevelOrList = Logger::toMonologLevel($minLevelOrList);
         $maxLevel = Logger::toMonologLevel($maxLevel);
         $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use($minLevelOrList, $maxLevel) {
             return $level >= $minLevelOrList && $level <= $maxLevel;
         }));
     }
     $this->acceptedLevels = array_flip($acceptedLevels);
 }
 /**
  * @param int   $defaultActionLevel   The default action level to be used if the record's category doesn't match any
  * @param array $channelToActionLevel An array that maps channel names to action levels.
  */
 public function __construct($defaultActionLevel, $channelToActionLevel = array())
 {
     $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel);
     $this->channelToActionLevel = array_map('Monolog\\Logger::toMonologLevel', $channelToActionLevel);
 }
 public function __construct($actionLevel)
 {
     $this->actionLevel = Logger::toMonologLevel($actionLevel);
 }
 public function __construct($level = Logger::DEBUG)
 {
     $this->level = Logger::toMonologLevel($level);
 }
 /**
  * Sets minimum logging level at which this handler will be triggered.
  *
  * @param  integer $level
  * @return self
  */
 public function setLevel($level)
 {
     $this->level = Logger::toMonologLevel($level);
     return $this;
 }
 /**
  * Sends the log header
  *
  * @see sendHeader()
  */
 protected function send()
 {
     if (self::$overflowed || !self::$sendHeaders) {
         return;
     }
     if (!self::$initialized) {
         self::$initialized = true;
         self::$sendHeaders = $this->headersAccepted();
         if (!self::$sendHeaders) {
             return;
         }
         self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
     }
     $json = @json_encode(self::$json);
     $data = base64_encode(utf8_encode($json));
     if (strlen($data) > 240 * 1024) {
         self::$overflowed = true;
         $record = array('message' => 'Incomplete logs, chrome header size limit reached', 'context' => array(), 'level' => Logger::WARNING, 'level_name' => Logger::getLevelName(Logger::WARNING), 'channel' => 'monolog', 'datetime' => new \DateTime(), 'extra' => array());
         self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record);
         $json = @json_encode(self::$json);
         $data = base64_encode(utf8_encode($json));
     }
     if (trim($data) !== '') {
         $this->sendHeader(self::HEADER_NAME, $data);
     }
 }
 public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array('Monolog\\'))
 {
     $this->level = Logger::toMonologLevel($level);
     $this->skipClassesPartials = $skipClassesPartials;
 }