예제 #1
0
 /**
  * Gathers informations about Server, execution environment, occured errors
  * and creates log files
  */
 public function createLogFile()
 {
     $logDir = Conf::get('logFileDir');
     if (is_writable($logDir) && Conf::get('createLogFile')) {
         $logDisplayArray = $this->loadLogDisplay();
         $header = "ignaszak/exception - https://github.com/ignaszak/\n" . sprintf("%-17.17s %s", "Date:", date('F d Y H:i:s')) . "\n" . sprintf("%-17.17s %s", "Reported errors:", $logDisplayArray['errorsCount']);
         $globalVars = Variable::getFormatedServerDataAsString();
         $content = strip_tags("{$header}\n\n\n{$globalVars}\n\n\n{$logDisplayArray['errors']}");
         $fileName = date('Y_m_d_H_i_s_u', time()) . '.log';
         file_put_contents("{$logDir}/{$fileName}", $content);
         chmod("{$logDir}/{$fileName}", 0664);
     }
 }
예제 #2
0
 /**
  * @return string
  */
 private function getServerData() : string
 {
     return str_replace("\n", "<br>", str_replace(" ", "&nbsp;", Variable::getFormatedServerDataAsString()));
 }
예제 #3
0
 public function testGetFormatedServerData()
 {
     $result = Variable::getFormatedServerDataAsString();
     $this->assertRegExp('/<b>\\$_SERVER<\\/b>/', $result);
 }