Skip to content

Commit

Permalink
Merge 10b4c15 into a79d14d
Browse files Browse the repository at this point in the history
  • Loading branch information
RiKap committed Aug 31, 2018
2 parents a79d14d + 10b4c15 commit 4765c0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/DI/SentryLoggingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ final class SentryLoggingExtension extends CompilerExtension
/** @var array */
private $defaults = [
'url' => NULL,
'enabled' => true,
];

/**
Expand All @@ -27,6 +28,7 @@ public function loadConfiguration()
$config = $this->validateConfig($this->defaults);

Validators::assertField($config, 'url', 'string', 'sentry URL (%)');
Validators::assertField($config, 'enabled', 'bool');

$builder->addDefinition($this->prefix('logger'))
->setClass(SentryLogger::class, [$config]);
Expand Down
1 change: 1 addition & 0 deletions src/Sentry/SentryLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function __construct(array $config)
*/
public function log($message, $priority)
{
if ($this->config['enabled'] !== true) return;
if (!in_array($priority, [ILogger::ERROR, ILogger::EXCEPTION, ILogger::CRITICAL], TRUE)) return;
if (!($message instanceof Exception)) return;

Expand Down

0 comments on commit 4765c0c

Please sign in to comment.