Contao\CoreBundle\Monolog\ContaoTableHandler::handle PHP Метод

handle() публичный Метод

public handle ( array $record )
$record array
    public function handle(array $record)
    {
        if (!$this->isHandling($record)) {
            return false;
        }
        $record = $this->processRecord($record);
        $record['formatted'] = $this->getFormatter()->format($record);
        if (!isset($record['extra']['contao']) || !$record['extra']['contao'] instanceof ContaoContext) {
            return false;
        }
        try {
            $this->write($record);
        } catch (\Exception $e) {
            return false;
        }
        $this->executeHook($record['message'], $record['extra']['contao']);
        return false === $this->bubble;
    }

Usage Example

Пример #1
0
 /**
  * Tests that the handle() method returns false if there is no Contao context.
  */
 public function testFalseWithoutContaoContext()
 {
     $record = ['level' => Logger::DEBUG, 'extra' => ['contao' => null], 'context' => []];
     $handler = new ContaoTableHandler();
     $this->assertFalse($handler->handle($record));
 }