Пример #1
0
 public function testLoggingMethods()
 {
     Logger::emergency("Test logger!");
     Logger::alert("Test logger!");
     Logger::critical("Test logger!");
     Logger::error("Test logger!");
     Logger::warning("Test logger!");
     Logger::notice("Test logger!");
     Logger::info("Test logger!");
     Logger::debug("Test logger!");
     $this->assertStringEqualsFile(vfsStream::url("logs/file.log"), $this->log);
 }
Пример #2
0
 /**
  *
  * @param \Exception $exception
  * @param string $prefix
  */
 public static function logException(\Exception $exception, $prefix = "Exception thrown")
 {
     $class = new \ReflectionClass($exception);
     Logger::error("{$prefix} [{$class->getName()}] {$exception->getMessage()} on line {$exception->getLine()} of {$exception->getFile()}");
     Logger::debug("Debug trace for exception {$exception->getTraceAsString()}");
 }