public function setBackend(Backend\BackendInterface $backend)
    {
        if ($this->psrCompatibleLoggerWasInjected) {
            throw new Exception('A PSR-3 logger was injected so setting backends is not possible. Create a new instance.', 1515342951935);
        }

        foreach ($this->backends as $backend) {
            $backend->close();
        }
        $this->backends = new \SplObjectStorage();
        $this->backends->attach($backend);
    }
public function setBackend(Backend\BackendInterface $backend)
    {
        if ($this->psrCompatibleLoggerWasInjected) {
            throw new Exception('A PSR-3 logger was injected so setting backends is not possible. Create a new instance.', 1515342951935);
        }

        foreach ($this->backends as $backend) {
            $backend->close();
        }
        $this->backends = new \SplObjectStorage();
        $this->backends->attach($backend);
    }
public function setBackend ( Backend \ BackendInterface $ backend ) { if ( $ this -> psrCompatibleLoggerWasInjected ) { throw new Exception ( 'A PSR-3 logger was injected so setting backends is not possible. Create a new instance.' , 1515342951935 ) ; } foreach ( $ this -> backends as $ backend ) { $ backend -> close ( ) ; } $ this -> backends = new \ SplObjectStorage ( ) ; $ this -> backends -> attach ( $ backend ) ; }
Sets the given backend as the only backend for this Logger.

This method allows for conveniently injecting a backend through some Objects.yaml configuration.

@param Backend\BackendInterface $backend A backend implementation
@return void
@api
@throws Exception
Sets the given backend as the only backend for this Logger .