- Issue created by @bfuzze9898
When instantiating the ActivityTrackingService service on a site using a non-core logger factory (e.g. Monolog), the following error is triggered:
The website encountered an unexpected error. Please try again later.
TypeError: Drupal\activity_tracking\Services\ActivityTrackingService::__construct(): Argument #5 ($loggerFactory) must be of type Drupal\Core\Logger\LoggerChannelFactory, Drupal\monolog\Logger\MonologLoggerChannelFactory given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\activity_tracking\Services\ActivityTrackingService->__construct() (line 55 of modules/contrib/activitytracking/src/Services/ActivityTrackingService.php).
Drupal\activity_tracking\Services\ActivityTrackingService->__construct(Object, Object, Object, Object, Object) (Line: 259)
Drupal\Component\DependencyInjection\Container->createService(Array, 'activity_tracking.logger') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('activity_tracking.logger') (Line: 197)
Drupal::service('activity_tracking.logger') (Line: 43)
activity_tracking_entity_update(Object)
...
Change the service constructor DI to expect an interface implementation instead of a core channel factory instance.
ActivityTrackingService.php
Change: LoggerChannelFactory $loggerFactory
To: LoggerChannelFactoryInterface $loggerFactory
Apply attached patch.
n/a
n/a
n/a
Active
1.5
Code