public function handle(array $record)
 {
     try {
         $this->streamHandler->handle($record);
     } catch (\UnexpectedValueException $e) {
         throw new CannotWriteToPrimaryLogException(sprintf('Cannot write to primary log: %s', $e->getMessage()), 0, $e);
     }
 }
 /**
  * @expectedException Exception
  * @expectedExceptionMessageRegExp /There is no existing directory at/
  * @covers Monolog\Handler\StreamHandler::__construct
  * @covers Monolog\Handler\StreamHandler::write
  */
 public function testWriteNonExistingAndNotCreatableFileResource()
 {
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         $this->markTestSkipped('Permissions checks can not run on windows');
     }
     $handler = new StreamHandler('file:///foo/bar/' . rand(0, 10000) . DIRECTORY_SEPARATOR . rand(0, 10000));
     $handler->handle($this->getRecord());
 }
 /**
  * @expectedException UnexpectedValueException
  * @covers Monolog\Handler\StreamHandler::__construct
  * @covers Monolog\Handler\StreamHandler::write
  */
 public function testWriteInvalidResource()
 {
     $handler = new StreamHandler('bogus://url');
     $handler->handle($this->getRecord());
 }
 /**
  * @expectedException UnexpectedValueException
  * @covers Monolog\Handler\StreamHandler::__construct
  * @covers Monolog\Handler\StreamHandler::write
  */
 public function testWriteNonExistingResource()
 {
     $handler = new StreamHandler('/foo/bar/baz/' . rand(0, 10000));
     $handler->handle($this->getRecord());
 }
 /**
  * @expectedException Exception
  * @expectedExceptionMessageRegExp /There is no existing directory at/
  * @covers Monolog\Handler\StreamHandler::__construct
  * @covers Monolog\Handler\StreamHandler::write
  */
 public function testWriteNonExistingAndNotCreatableFileResource()
 {
     $handler = new StreamHandler('file:///foo/bar/' . rand(0, 10000) . DIRECTORY_SEPARATOR . rand(0, 10000));
     $handler->handle($this->getRecord());
 }