1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 21:26:43 +02:00

Include record message/context/extra data when throwing an exception because the log cannot be opened, fixes #1630

This commit is contained in:
Jordi Boggiano
2022-03-14 13:34:54 +01:00
parent e289293a7c
commit c02d86ffb2
7 changed files with 39 additions and 10 deletions

View File

@@ -145,9 +145,16 @@ class StreamHandlerTest extends TestCase
public function testWriteInvalidResource()
{
$this->expectException(\UnexpectedValueException::class);
$this->expectExceptionMessage('The stream or file "bogus://url" could not be opened in append mode: Failed to open stream: No such file or directory
The exception occurred while attempting to log: test
Context: {"foo":"bar"}
Extra: [1,2,3]');
$handler = new StreamHandler('bogus://url');
$handler->handle($this->getRecord());
$record = $this->getRecord();
$record['context'] = ['foo' => 'bar'];
$record['extra'] = [1, 2, 3];
$handler->handle($record);
}
/**