Skip to content

Commit

Permalink
Merge pull request #644 from rollbar/changed/exposed-telemeter-getlev…
Browse files Browse the repository at this point in the history
…elfrompsrlevel-method

Changed the `Telemeter::getLevelFromPsrLevel()` method from private to public.
  • Loading branch information
danielmorell authored Jan 10, 2025
2 parents 5d78046 + 30c4623 commit 81638a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Telemetry/Telemeter.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private static function getTypeFromLevel(string $level): EventType
* @param string $level The PSR-3 log level.
* @return EventLevel
*/
private static function getLevelFromPsrLevel(string $level): EventLevel
public static function getLevelFromPsrLevel(string $level): EventLevel
{
return match ($level) {
Level::EMERGENCY, Level::ALERT, Level::CRITICAL => EventLevel::Critical,
Expand Down
12 changes: 12 additions & 0 deletions tests/Telemetry/TelemeterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ public function testMaxEventConstrains(): void
self::assertSame(100, $telemeter->getMaxQueueSize());
}

public function testGetLevelFromPsrLevel(): void
{
self::assertSame(EventLevel::Critical, Telemeter::getLevelFromPsrLevel(Level::EMERGENCY));
self::assertSame(EventLevel::Critical, Telemeter::getLevelFromPsrLevel(Level::ALERT));
self::assertSame(EventLevel::Critical, Telemeter::getLevelFromPsrLevel(Level::CRITICAL));
self::assertSame(EventLevel::Error, Telemeter::getLevelFromPsrLevel(Level::ERROR));
self::assertSame(EventLevel::Warning, Telemeter::getLevelFromPsrLevel(Level::WARNING));
self::assertSame(EventLevel::Info, Telemeter::getLevelFromPsrLevel(Level::NOTICE));
self::assertSame(EventLevel::Info, Telemeter::getLevelFromPsrLevel(Level::INFO));
self::assertSame(EventLevel::Debug, Telemeter::getLevelFromPsrLevel(Level::DEBUG));
}

public function testScope(): void
{
$telemeter = new Telemeter();
Expand Down

0 comments on commit 81638a1

Please sign in to comment.