You are here

private function NewRelicLoggerTest::getLogger in New Relic 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/Logger/NewRelicLoggerTest.php \Drupal\Tests\new_relic_rpm\Unit\Logger\NewRelicLoggerTest::getLogger()
  2. 2.0.x tests/src/Unit/Logger/NewRelicLoggerTest.php \Drupal\Tests\new_relic_rpm\Unit\Logger\NewRelicLoggerTest::getLogger()

Get a preconfigured logger.

Parameters

\Drupal\new_relic_rpm\ExtensionAdapter\NewRelicAdapterInterface $adapter: The adapter to use.

array $levels: The log levels to report.

Return value

\Drupal\new_relic_rpm\Logger\NewRelicLogger A new logger instance.

5 calls to NewRelicLoggerTest::getLogger()
NewRelicLoggerTest::testCreatesMessage in tests/src/Unit/Logger/NewRelicLoggerTest.php
Test that we log a message.
NewRelicLoggerTest::testExceptionPassing in tests/src/Unit/Logger/NewRelicLoggerTest.php
Test that exceptions are being passed to the adapter.
NewRelicLoggerTest::testHandlesUnknownLevel in tests/src/Unit/Logger/NewRelicLoggerTest.php
Test that an unknown log level is handled.
NewRelicLoggerTest::testIgnoresUnselectedLevelMessages in tests/src/Unit/Logger/NewRelicLoggerTest.php
Test that log levels not requested are ignored.
NewRelicLoggerTest::testLogsSelectedLevelMessages in tests/src/Unit/Logger/NewRelicLoggerTest.php
Test that log levels requested are logged.

File

tests/src/Unit/Logger/NewRelicLoggerTest.php, line 42

Class

NewRelicLoggerTest
@coversDefaultClass \Drupal\new_relic_rpm\Logger\NewRelicLogger @group new_relic_rpm

Namespace

Drupal\Tests\new_relic_rpm\Unit\Logger

Code

private function getLogger(NewRelicAdapterInterface $adapter, array $levels = []) {
  $parser = new LogMessageParser();
  $config = $this
    ->getConfigFactoryStub([
    'new_relic_rpm.settings' => [
      'watchdog_severities' => $levels,
    ],
  ]);
  return new NewRelicLogger($parser, $adapter, $config);
}