public function dispatch($messages, $final)
    {
        $targetErrors = [];
        foreach ($this->targets as $target) {
            if ($target->enabled) {
                try {
                    $target->collect($messages, $final);
                } catch (\Exception $e) {
                    $target->enabled = false;
                    $targetErrors[] = [
                        'Unable to send log via ' . get_class($target) . ': ' . ErrorHandler::convertExceptionToVerboseString($e),
                        Logger::LEVEL_WARNING,
                        __METHOD__,
                        microtime(true),
                        [],
                    ];
                }
            }
        }

        if (!empty($targetErrors)) {
            $this->dispatch($targetErrors, true);
        }
    }
public function dispatch($messages, $final)
    {
        $targetErrors = [];
        foreach ($this->targets as $target) {
            if ($target->enabled) {
                try {
                    $target->collect($messages, $final);
                } catch (\Exception $e) {
                    $target->enabled = false;
                    $targetErrors[] = [
                        'Unable to send log via ' . get_class($target) . ': ' . ErrorHandler::convertExceptionToVerboseString($e),
                        Logger::LEVEL_WARNING,
                        __METHOD__,
                        microtime(true),
                        [],
                    ];
                }
            }
        }

        if (!empty($targetErrors)) {
            $this->dispatch($targetErrors, true);
        }
    }
public function dispatch ( $ messages , $ final ) { $ targetErrors = [ ] ; foreach ( $ this -> targets as $ target ) { if ( $ target -> enabled ) { try { $ target -> collect ( $ messages , $ final ) ; } catch ( \ Exception $ e ) { $ target -> enabled = false ; $ targetErrors [ ] = [ 'Unable to send log via ' . get_class ( $ target ) . ': ' . ErrorHandler :: convertExceptionToVerboseString ( $ e ) , Logger :: LEVEL_WARNING , __METHOD__ , microtime ( true ) , [ ] , ] ; } } } if ( ! empty ( $ targetErrors ) ) { $ this -> dispatch ( $ targetErrors , true ) ; } }
Dispatches the logged messages to [[targets]].
@param array $messages the logged messages
@param bool $final whether this method is called at the end of the current application
Dispatches the logged messages to [[ targets ]] .