1<?php 2 3namespace Mpdf\PsrLogAwareTrait; 4 5use Psr\Log\LoggerInterface; 6 7trait MpdfPsrLogAwareTrait 8{ 9 10 /** 11 * @var \Psr\Log\LoggerInterface 12 */ 13 protected $logger; 14 15 public function setLogger(LoggerInterface $logger) 16 { 17 $this->logger = $logger; 18 if (property_exists($this, 'services') && is_array($this->services)) { 19 foreach ($this->services as $name) { 20 if ($this->$name && $this->$name instanceof \Psr\Log\LoggerAwareInterface) { 21 $this->$name->setLogger($logger); 22 } 23 } 24 } 25 } 26 27} 28