/**
  * BasicInfoAttachment constructor.
  *
  * @param array $record
  * @param ErrorInterface $error
  */
 public function __construct(array $record, ErrorInterface $error = null)
 {
     $this->record = $record;
     $this->error = $error;
     $message = $this->error !== null ? $this->error->getMessage() : $this->record['message'];
     parent::__construct($message);
     $this->setColour($this->getColourForLoggerLevel());
     $this->setText(sprintf('*Error:* %s', $this->record['level_name']));
     $this->addField(new Field('What', $message));
     $this->addField(new Field('When', $this->record['datetime']->format('d/m/Y H:i:s'), true));
     $this->addRecordDataAsJsonEncodedField('context', 'Context');
     $this->addRecordDataAsJsonEncodedField('extra', 'Extra');
     if ($this->error !== null) {
         $this->addField(new Field('Line', $this->error->getLine(), true));
         $this->addField(new Field('File', $this->error->getFile()));
     }
 }