Skip to content

Fix usage of deprecated class #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Factories/RollbarHandlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace Rollbar\Symfony\RollbarBundle\Factories;

use Psr\Log\LogLevel;
use Rollbar\Monolog\Handler\RollbarHandler;
use Monolog\Handler\Handler;
use Monolog\Handler\RollbarHandler;
use Rollbar\Monolog\Handler\RollbarHandler as LegacyRollbarHandler;
use Rollbar\Rollbar;
use Rollbar\Symfony\RollbarBundle\DependencyInjection\RollbarExtension;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down Expand Up @@ -52,10 +54,14 @@ public function __construct(ContainerInterface $container)
/**
* Create RollbarHandler
*
* @return RollbarHandler
* @return Handler
*/
public function createRollbarHandler(): RollbarHandler
public function createRollbarHandler(): Handler
{
if (! class_exists(RollbarHandler::class)) {
return new LegacyRollbarHandler(Rollbar::logger(), LogLevel::ERROR);
}

return new RollbarHandler(Rollbar::logger(), LogLevel::ERROR);
}
}
5 changes: 4 additions & 1 deletion Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ services:
arguments:
- '@service_container'

Rollbar\Monolog\Handler\RollbarHandler:
Monolog\Handler\RollbarHandler:
factory: ['@Rollbar\Symfony\RollbarBundle\Factories\RollbarHandlerFactory', createRollbarHandler]
tags:
- { name: monolog.logger, channel: rollbar }

Rollbar\Monolog\Handler\RollbarHandler:
alias: Monolog\Handler\RollbarHandler

Rollbar\Symfony\RollbarBundle\Payload\Generator:
arguments:
- '@service_container'