Ejemplo n.º 1
0
 public function testCreateStreamWriter()
 {
     $filePath = ROOT_PATH . self::FILE_PATH;
     $result = $this->testedObject->createStreamWriter($filePath, null, '---');
     $this->assertInstanceOf(Stream::class, $result);
     $this->assertTrue(file_exists($filePath));
 }
Ejemplo n.º 2
0
 /**
  * @param string      $name
  * @param string|null $path
  * @param string|null $separator
  *
  * @return Logger
  */
 public function createLog($name = 'app', $path = null, $separator = null)
 {
     $path = $this->preparePath($path);
     $separator = $this->prepareSeparator($separator);
     $logger = $this->componentsFactory->createLogger();
     $filePathName = $path . date('Ymd') . sprintf('.%s.log', $name);
     $errorWriter = $this->componentsFactory->createStreamWriter($filePathName, null, $separator);
     $logger->addWriter($errorWriter);
     return $logger;
 }