mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-07 21:56:31 +02:00
Add ability to indent stack traces in LineFormatter, fixes #1835
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Monolog\Formatter;
|
||||
|
||||
use Monolog\Test\TestCase;
|
||||
use Monolog\Level;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @covers Monolog\Formatter\LineFormatter
|
||||
@@ -277,6 +278,19 @@ class LineFormatterTest extends TestCase
|
||||
$this->assertMatchesRegularExpression('/foo\nbar/', $message);
|
||||
}
|
||||
|
||||
public function testIndentStackTraces(): void
|
||||
{
|
||||
$formatter = new LineFormatter();
|
||||
$formatter->includeStacktraces();
|
||||
//$formatter->allowInlineLineBreaks();
|
||||
$formatter->indentStackTraces(' ');
|
||||
$message = $formatter->format($this->getRecord(message: "foo", context: ['exception' => new RuntimeException('lala')]));
|
||||
|
||||
$this->assertStringContainsString(' [stacktrace]', $message);
|
||||
$this->assertStringContainsString(' #0', $message);
|
||||
$this->assertStringContainsString(' #1', $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerMaxLevelNameLength
|
||||
*/
|
||||
|
Reference in New Issue
Block a user