Beispiel #1
0
 /**
  * Constructor
  *
  * @param  string $stream the stream
  * @param  bool $color use ANSI color formatter or not
  * @param  FormatterInterface $formatter
  * @param  bool $stopPropagation
  * @access public
  * @since  2.0.1 removed level param
  */
 public function __construct($stream = 'php://stderr', $color = true, FormatterInterface $formatter = null, $stopPropagation = false)
 {
     if ($this->isCliMode()) {
         $this->color = (bool) $color;
         if (!in_array($stream, ['php://stderr', 'php://stdout'])) {
             throw new LogicException(Message::get(Message::LOG_STREAM_INVALID, $stream), Message::LOG_STREAM_INVALID);
         }
         parent::__construct($stream, $formatter, $stopPropagation);
     }
 }
Beispiel #2
0
 /**
  * Constructor
  *
  * @param  string $path full path
  * @param  int $rotate rotate type or filesize in MB
  * @param  FormatterInterface $formatter
  * @param  bool $stopPropagation
  * @throws LogicException if path not writable
  * @access public
  * @since  2.0.1 removed level param
  */
 public function __construct($path, $rotate = self::ROTATE_NONE, FormatterInterface $formatter = null, $stopPropagation = false)
 {
     // remove prefix 'file://' if any
     if ('file://' === substr($path, 0, 7)) {
         $path = substr($path, 7);
     }
     // check file path
     $this->checkPath($path);
     // rotate file ?
     if (file_exists($path)) {
         $this->doRotation($path, $rotate);
     }
     parent::__construct($path, $formatter, $stopPropagation);
 }