Create error.log if doesn't exist, we need from init

This commit is contained in:
mattpass
2021-06-26 22:17:52 +01:00
parent 7075ced50f
commit 80bdd04e59

View File

@@ -21,6 +21,16 @@ class System
}
}
/**
* @param $path
*/
private function createFileIfNotExists($path)
{
if (false === file_exists($path)) {
touch($path);
}
}
/**
* @return string
*/
@@ -40,6 +50,7 @@ class System
ini_set('log_errors', '1');
$this->createDirIfNotExists(dirname(__FILE__) . '/../data/logs');
$this->createDirIfNotExists(dirname(__FILE__) . '/../data/logs/error');
$this->createFileIfNotExists(dirname(__FILE__) . '/../data/logs/error/error.log');
ini_set('error_log', dirname(__FILE__) . '/../data/logs/error/error.log');
error_reporting(-1);
}