Skip to content

Commit

Permalink
Default log levels to emergency and critical
Browse files Browse the repository at this point in the history
  • Loading branch information
chadicus committed Aug 12, 2018
1 parent 43862f9 commit dddd843
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/NewRelicLogger.php
Expand Up @@ -38,9 +38,7 @@ final class NewRelicLogger extends AbstractLogger implements LoggerInterface
*/
const DEFAULT_OBSERVED_LEVELS = [
LogLevel::EMERGENCY,
LogLevel::ALERT,
LogLevel::CRITICAL,
LogLevel::ERROR,
];

/**
Expand Down
16 changes: 8 additions & 8 deletions tests/NewRelicLoggerTest.php
Expand Up @@ -20,9 +20,9 @@ final class NewRelicLoggerTest extends \PHPUnit\Framework\TestCase
*/
public function logWithOnlyMessage()
{
$newRelicAgentMock = $this->getNewRelicAgentMock(LogLevel::ERROR, 'an error message', ['foo' => 'bar']);
$newRelicAgentMock = $this->getNewRelicAgentMock(LogLevel::CRITICAL, 'an error message', ['foo' => 'bar']);
$logger = new NewRelicLogger($newRelicAgentMock);
$logger->log(LogLevel::ERROR, 'an error message', ['foo' => 'bar']);
$logger->log(LogLevel::CRITICAL, 'an error message', ['foo' => 'bar']);
}

/**
Expand All @@ -34,9 +34,9 @@ public function logWithOnlyMessage()
public function logWithException()
{
$exception = new \RuntimeException();
$newRelicAgentMock = $this->getNewRelicAgentMock(LogLevel::ALERT, 'an alert message', [], $exception);
$newRelicAgentMock = $this->getNewRelicAgentMock(LogLevel::EMERGENCY, 'an alert message', [], $exception);
$logger = new NewRelicLogger($newRelicAgentMock);
$logger->log(LogLevel::ALERT, 'an alert message', ['exception' => $exception]);
$logger->log(LogLevel::EMERGENCY, 'an alert message', ['exception' => $exception]);
}

/**
Expand All @@ -63,15 +63,15 @@ public function logIgnoredLevel()
public function logWithNonScalarContext()
{
$newRelicAgentMock = $this->getNewRelicAgentMock(
LogLevel::ERROR,
LogLevel::CRITICAL,
'an error message',
[
'foo' => 'bar',
'extra' => var_export(new \StdClass(), true),
]
);
$logger = new NewRelicLogger($newRelicAgentMock);
$logger->log(LogLevel::ERROR, 'an error message', ['foo' => 'bar', 'extra' => new \StdClass()]);
$logger->log(LogLevel::CRITICAL, 'an error message', ['foo' => 'bar', 'extra' => new \StdClass()]);
}

/**
Expand All @@ -90,9 +90,9 @@ public function logError()
$error->getFile(),
$error->getLine()
);
$newRelicAgentMock = $this->getNewRelicAgentMock(LogLevel::ALERT, 'an error message', [], $exception);
$newRelicAgentMock = $this->getNewRelicAgentMock(LogLevel::EMERGENCY, 'an error message', [], $exception);
$logger = new NewRelicLogger($newRelicAgentMock);
$logger->log(LogLevel::ALERT, 'an error message', ['exception' => $error]);
$logger->log(LogLevel::EMERGENCY, 'an error message', ['exception' => $error]);
}

private function getNewRelicAgentMock(
Expand Down

0 comments on commit dddd843

Please sign in to comment.