public function __construct(Telemetry_Client $telemetryClient)
 {
     parent::__construct();
     if (isset($this->instrumentationKey)) {
         $this->telemetryClient = $telemetryClient;
         $this->telemetryClient->getContext()->setInstrumentationKey($this->instrumentationKey);
     }
 }
 /**
  * Writes the record down to the log of the implementing handler
  *
  * @param  array $record
  *
  * @return void
  */
 protected function write(array $record)
 {
     if (isset($record['context']['exception'])) {
         $this->client->trackException($record['context']['exception'], $record);
     } else {
         $this->client->trackMessage((string) $record['message'], $record);
     }
     $this->client->flush();
 }