Skip to content

Commit 27d841a

Browse files
committed
refactor
1 parent 5b389ce commit 27d841a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

framework/Application.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,22 @@ protected function dispatch()
199199
public function errorHandler($errno, $errstr, $errorFile, $errorLine)
200200
{
201201
$this->logError($errno, $errstr, $errorFile, $errorLine);
202+
//TODO: display error
202203
// $this->displayError($errno, $errstr, $errorFile, $errorLine);
203204

204205
return true;
205206

206207
}
207208
protected function logError($errno, $errstr, $errorFile, $errorLine)
208209
{
210+
$dir = check_or_make_dir('storage/logs');
211+
212+
$errorFilePath = $dir . DS . 'error.log';
213+
209214
error_log(
210215
"[" . date('Y-m-d H:i:s') . "] Error number: {$errno} | Error string: {$errstr} | Error file: {$errorFile} | Error line: {$errorLine} \n",
211216
3,
212-
// ROOT . DS . 'storage' . DS . 'logs' . DS . 'error.log'
213-
base_path('storage/logs/error.log')
217+
$errorFilePath
214218
);
215219

216220
}
@@ -219,10 +223,8 @@ protected function displayError($severity, $messages, $file, $line, $responseCod
219223
http_response_code($responseCode);
220224
if ($this->config['debug']) {
221225
include_file('resources/error-templates/debug_template.php');
222-
// include_once(ROOT . DS . 'resources' . DS . 'error-templates' . DS . 'error_template.php');
223226
} else {
224227
include_file('resources/error-templates/error_template.php');
225-
// include_once(ROOT . DS . 'resources' . DS . 'error-templates' . DS . 'error_template.php');
226228
}
227229
exit();
228230
}

0 commit comments

Comments
 (0)