game/core1/app/core/generalexception.php

24 lines
779 B
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?php
namespace Core;
class GeneralException extends \Exception {
public function __construct($message, $code = 0) {
$s = '';
$s .= 'Server date & time: ' . date('d.m.Y H:i:s') . "\n";
$s .= 'Error code: ' . $code . "\n";
$s .= 'Error message: ' . $message . "\n";
$s .= 'In file: ' . $this->getFile() . "\n";
$s .= 'In line: ' . $this->getLine() . "\n";
$s .= 'Client IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
$s .= 'GET Data: ' . serialize($_GET) . "\n";
$s .= 'POST Data: ' . serialize($_POST) . "\n";
$s .= 'Call Stack Trace: ' . "\n";
foreach ( debug_backtrace() as $stack ) {
$s .= "\tFILE: '" . $stack['file'] . "', LINE: '" . $stack['line'] . "';\n";
}
file_put_contents(PROJECT_PATH . DS . 'log/error.log', $s . "\n", FILE_APPEND);
}
}
?>