Skip to content

Commit

Permalink
Add RequestIntegration back
Browse files Browse the repository at this point in the history
  • Loading branch information
Taluu committed Aug 19, 2019
1 parent 2a3de03 commit 839f904
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions DependencyInjection/MonologExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,14 +683,40 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
);

if (!empty($handler['environment'])) {
$options->addMethodCall('setEnvironment', [$handler['environment']]);
$options->addMethodCall(
'setEnvironment',
array($handler['environment'])
);
}

if (!empty($handler['release'])) {
$options->addMethodCall('setRelease', [$handler['release']]);
$options->addMethodCall(
'setRelease',
array($handler['release'])
);
}

$builder = new Definition('Sentry\\ClientBuilder', array($options));
$prefix = md5(uniqid(mt_rand(), true));
$container->setDefinition("{$prefix}.sentry.options", $options);

$requestIntegration = new Definition(
'Sentry\\Integration\\RequestIntegration',
array(new Reference("{$prefix}.sentry.options"))
);

$options->addMethodCall(
'setIntegrations',
array(array($requestIntegration))
);

$options->setPublic(false);

// BC Symfony < 4
if (method_exists($options, 'setPrivate')) {
$options->setPrivate(true);
}

$builder = new Definition('Sentry\\ClientBuilder', array(new Reference("{$prefix}.sentry.options")));

$client = new Definition('Sentry\\Client');
$client->setFactory(array($builder, 'getClient'));
Expand All @@ -708,9 +734,6 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
array(new Reference($clientId))
);

// can't set the hub to the current hub, getting into a recursion otherwise...
//$hub->addMethodCall('setCurrent', array($hub));

$definition->setArguments(array(
$hub,
$handler['level'],
Expand Down

0 comments on commit 839f904

Please sign in to comment.