Ejemplo n.º 1
0
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->logger = new Logger($this->getName());
     $this->logger->pushHandler(new ConsoleHandler($output));
     $this->logger->pushProcessor(new MemoryPeakUsageProcessor());
     if (!empty($this->getConfig()->getLogFilename())) {
         $this->logger->pushHandler(new StreamHandler($this->getConfig()->getLogFilename()));
     }
     $this->symfonyStyle = new SymfonyStyle($input, $output);
     $this->getLogger()->debug('Config file', ['file' => $this->getApplication()->getConfigDefaultPath()]);
 }
Ejemplo n.º 2
0
 public function testGetLogsWithDebugProcessor2()
 {
     $handler = new TestHandler();
     $logger = new Logger('test', array($handler));
     $logger->pushProcessor(new DebugProcessor());
     $logger->addInfo('test');
     $this->assertCount(1, $logger->getLogs());
     list($record) = $logger->getLogs();
     $this->assertEquals('test', $record['message']);
     $this->assertEquals(Logger::INFO, $record['priority']);
 }