attachments[spl_object_id($attachment)] = $attachment; } public function removeAttachment(\LoggerAttachment $attachment){ unset($this->attachments[spl_object_id($attachment)]); } public function removeAttachments(){ $this->attachments = []; } public function getAttachments(){ return $this->attachments; } public function log($level, $message){ parent::log($level, $message); foreach($this->attachments as $attachment){ $attachment->log($level, $message); } } }