- Fixed errorLogPath default value if none is provided

This commit is contained in:
Dave M. 2026-07-07 12:24:57 +00:00
parent 90a2f4d083
commit 4834404575
2 changed files with 7 additions and 3 deletions

View File

@ -1,7 +1,11 @@
<?php <?php
try { try {
require_once(dirname(__DIR__)."/src/Kernel.php"); $projectPath = dirname(__DIR__);
require_once $projectPath . '/vendor/autoload.php';
new class($projectPath) extends %NAMESPACE%\Kernel {};
} }
catch(\Throwable $t) { catch(\Throwable $t) {
echo sprintf("%s in <strong>%s</strong> <pre>%s</pre>", $t->getMessage(), $t->getFile() . ":" . $t->getLine(), $t->getTraceAsString()); echo sprintf("%s in <strong>%s</strong> <pre>%s</pre>", $t->getMessage(), $t->getFile() . ":" . $t->getLine(), $t->getTraceAsString());

View File

@ -30,7 +30,6 @@ class Kernel
public string $errorLogPath; public string $errorLogPath;
public function __construct( public function __construct(
public string $projectPath public string $projectPath
) )
@ -99,11 +98,12 @@ class Kernel
} }
ini_set("log_errors", "1"); ini_set("log_errors", "1");
ini_set("error_log", $this->errorLogPath); ini_set("error_log", $this->errorLogPath ?? getenv("LOGS_PATH") . DIRECTORY_SEPARATOR. date("Y-m").".log");
ini_set('display_errors', getenv("DEBUG") ? 'on' : 'on'); ini_set('display_errors', getenv("DEBUG") ? 'on' : 'on');
error_reporting($this->errorReporting); error_reporting($this->errorReporting);
return $this; return $this;
} }