protected function dumpNotifications(\PhpConsole\Handler $console, $notifications) { if ($notifications instanceof $notifications) { $notifications->each(function (MessageInterface $message) use($console) { $console->debug((string) $message, $message->getType()); }); } else { $console->debug('Notifications should be ' . Stack::class . 'instances', 'console.error'); } }
/** * Processes log messages and sends them to specific destination. * * @param array $logs List of messages. Each array elements represents one message * with the following structure: * array( * [0] => message (string) * [1] => level (string) * [2] => category (string) * [3] => timestamp (float, obtained by microtime(true)); * @return bool */ protected function processLogs($logs) { if ($this->handler) { foreach ($logs as $log) { if (is_scalar($log[0])) { if ($log[1] == 'info') { $this->handler->debug($log[0], $log[2], 9); } } } } return true; }
public function testHandleDebug() { $debug = null; $test = $this; $this->connector->expects($this->once())->method('sendMessage')->with($this->callback(function (\PhpConsole\DebugMessage $message) use($test, &$debug) { $lastCall = end($message->trace); $test->assertContainsRecursive($debug, $message); $test->assertContains(__CLASS__, $lastCall->call); $test->assertContains($test->getName(), $lastCall->call); return true; })); $this->handler->start(); $this->handler->getConnector()->getDebugDispatcher()->detectTraceAndSource = true; $debug = array('type' => 'debug', 'data' => 'data', 'tags' => array('t', 'a', 'g', 's'), 'file' => __FILE__, 'line' => __LINE__ + 2); $this->handler->debug($debug['data'], implode('.', $debug['tags'])); }