Skip to content

Commit f0cea68

Browse files
authored
Returned tracy 2.7 support (#41)
* Returned tracy 2.7 support * Removed typehint to be compatible with Tracy\Logger * Added test to access priority * Changed test - level_name should be info * Spaces > tabs
1 parent d971613 commit f0cea68

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"nette/di": "^3.0",
2323
"kdyby/strict-objects": "^2.0",
2424
"monolog/monolog": "^2.0",
25-
"tracy/tracy": "^3.0"
25+
"tracy/tracy": "^2.7 || ^3.0"
2626
},
2727
"require-dev": {
2828
"nette/application": "^3.0",

src/Tracy/BlueScreenRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function renderToFile($exception, $file): string
3636
* @internal
3737
* @deprecated
3838
*/
39-
public function log($message, string $priority = self::INFO): ?string
39+
public function log($message, $priority = self::INFO): ?string
4040
{
4141
throw new \Kdyby\Monolog\Exception\NotSupportedException('This class is only for rendering exceptions');
4242
}

src/Tracy/MonologAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function getExceptionFile(\Throwable $exception, string $level = self::EX
7272
return $this->blueScreenRenderer->getExceptionFile($exception);
7373
}
7474

75-
public function log($originalMessage, string $priority = self::INFO): ?string
75+
public function log($originalMessage, $priority = self::INFO): ?string
7676
{
7777
$message = $this->formatMessage($originalMessage);
7878
$context = [

tests/KdybyTests/Monolog/MonologAdapterTest.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@ class MonologAdapterTest extends \Tester\TestCase
9292
Assert::match('CLI%a%: %a%/MonologAdapterTest.phpt%a%', $record['context']['at']);
9393
}
9494

95+
public function testLogWithAccessPriority()
96+
{
97+
$this->adapter->log('test access message', MonologAdapter::ACCESS);
98+
Assert::count(1, $this->testHandler->getRecords());
99+
100+
list($record) = $this->testHandler->getRecords();
101+
Assert::same('kdyby', $record['channel']);
102+
Assert::same('test access message', $record['message']);
103+
Assert::same('INFO', $record['level_name']);
104+
Assert::same(MonologAdapter::ACCESS, $record['context']['priority']);
105+
Assert::match('CLI%a%: %a%/MonologAdapterTest.phpt%a%', $record['context']['at']);
106+
}
107+
95108
}
96109

97110
(new MonologAdapterTest())->run();

0 commit comments

Comments
 (0)