public function setUp() { $this->logger = new Logger('phpunit-logger'); $directoryLogOutput = self::$directoryV->url() . '/log'; if (!file_exists($directoryLogOutput)) { mkdir($directoryLogOutput, 0700, true); } $output = "%level_name% > %message% %context% %extra%\n"; $formatter = new LineFormatter($output); $handler = new StreamHandler($directoryLogOutput . '/phpunit.log', Logger::DEBUG, true, null, false); touch($directoryLogOutput . '/phpunit.log'); $handler->setFormatter($formatter); $this->logger->pushHandler($handler); $this->logger->info('Avviato test -> ' . $this->getName()); }
/** * Create a neaw stream handler * * @param string $path * @param int $level * @param Boolean $bubble * * @return \Monolog\Handler\StreamHandler */ public function addStream($path, $level, $bubble = true) { $this->logger->pushHandler($handler = new StreamHandler($path, $this->parseLevel($level), $bubble)); $handler->setFormatter($this->getDefaultFormatter()); return $this; }