You are here

public function ApiClientProfiler::__construct in Apigee Edge 8

ApiClientProfiler constructor.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: Config factory.

\Psr\Log\LoggerInterface $logger: Logger.

\Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager $debug_message_formatter_plugin: Debug message formatter plugin manager.

File

modules/apigee_edge_debug/src/HttpClientMiddleware/ApiClientProfiler.php, line 68

Class

ApiClientProfiler
Http client middleware that profiles Apigee Edge API calls.

Namespace

Drupal\apigee_edge_debug\HttpClientMiddleware

Code

public function __construct(ConfigFactoryInterface $config_factory, LoggerInterface $logger, DebugMessageFormatterPluginManager $debug_message_formatter_plugin) {

  // On module install, this constructor is called earlier than
  // the module's configuration would have been imported to the database.
  // In that case the $formatterPluginId is missing and it causes fatal
  // errors.
  $formatter_plugin_id = $config_factory
    ->get('apigee_edge_debug.settings')
    ->get('formatter');
  if ($formatter_plugin_id) {
    $this->formatter = $debug_message_formatter_plugin
      ->createInstance($formatter_plugin_id);
  }
  $this->logFormat = $config_factory
    ->get('apigee_edge_debug.settings')
    ->get('log_message_format');
  $this->logger = $logger;
}