コード例 #1
0
ファイル: index.php プロジェクト: uaktags/lyraEngine
                        $args[] = get_resource_type($arg);
                    } else {
                        $args[] = $arg;
                    }
                }
                $args = join(", ", $args);
            }
            $rtn .= sprintf("#%s %s(%s): %s(%s)\n", $count, isset($frame['file']) ? $frame['file'] : 'unknown file', isset($frame['line']) ? $frame['line'] : 'unknown line', isset($frame['class']) ? $frame['class'] . $frame['type'] . $frame['function'] : $frame['function'], $args);
            $count++;
        }
        return $rtn;
    }
    file_put_contents(__DIR__ . '/log/exceptions.log', "\n" . $errorMessage . "\n" . getExceptionTraceAsString($e) . "\n", FILE_APPEND);
    exit('Exception: ' . $errorCode . '<br><br><small>The issue has been logged. Please contact the website administrator.</small><br>' . $errorMessage);
}
try {
    // Load Last 10 Git Logs
    $git_diff = [];
    $git_logs = [];
    exec("git log -1 --pretty=format:%h", $git_logs);
    exec("git add .");
    exec("git log --shortstat --oneline  origin/master HEAD^", $git_diff);
    $hash = explode(' ', $git_logs[0]);
    $hash = trim(end($hash));
    echo "lyraEngine is up to date with: <a href='https://github.com/uaktags/lyraEngine/commit/{$hash}'>{$hash}</a>";
    echo "<pre>";
    print_r($git_diff);
    echo "</pre>";
} catch (\Exception $e) {
    file_put_contents(__DIR__ . '/log/exceptions.log', "\n" . "GIT Version was attempted, but not installed with GIT" . "\n" . getExceptionTraceAsString($e) . "\n", FILE_APPEND);
}
コード例 #2
0
ファイル: Helper.php プロジェクト: noikiy/inovi
 function showException($e)
 {
     $_REQUEST['exception'] = $e;
     return context()->dispatch(with(new Container())->setModule('www')->setController('error')->setAction('index'));
     $code = $e->getCode();
     $file = $e->getFile();
     $line = $e->getLine();
     $date = date('M d, Y h:iA');
     echo '<style>.error {font-weight: bold; color: red; width: 30%; padding: 10px; margin: 10px; border: solid 1px red;}</style>';
     echo "Thin has caught an exception: ";
     $html = "<p>\n            <strong>Date:</strong> {$date}\n         </p>\n\n         <p>\n            <strong>Message:</strong>\n            <div class=error>{$e->getMessage()}</div>\n         </p>\n\n         <p>\n            <strong>Code:</strong> {$code}\n         </p>\n\n         <p>\n            <strong>File:</strong> {$file}\n         </p>\n\n         <p>\n            <strong>Line:</strong> {$line}\n         </p>\n\n         <h3>Stack trace:</h3>";
     echo $html;
     echo '<pre style="padding: 5px;">';
     echo getExceptionTraceAsString($e);
     echo '</pre>';
 }
コード例 #3
0
ファイル: IAuthCommon.php プロジェクト: shiyake/php-ihome
function errorLog($exception)
{
    $appid = GetAppInfo('WSC', 0);
    if ($appid == '================' && !empty(IAuthException::$Info['appid'])) {
        $appid = IAuthException::$Info['appid'];
    }
    if (!empty(IAuthException::$Info['ip'])) {
        $ip = IAuthException::$Info['ip'];
    } else {
        $ip = empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    $time = date('Y-m-d H:i:s', time());
    $msg = $exception->getMessage();
    $detail = $exception->getDetail();
    if (DEBUG_MOD == ON) {
        $stack = getExceptionTraceAsString($exception);
        $filename = substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/'));
        $lineToWrite = "\n====================" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . "====================\n" . print_r($_SERVER, true) . "\n========== content =========\n" . file_get_contents('php://input') . "\n{$detail}\n" . $stack;
        $file = fopen(IAUTH_ERROR_LOG_FILE, 'a');
        if ($file) {
            fwrite($file, $lineToWrite);
            fclose($file);
        }
    }
    if ($msg == 'server db error') {
        $stack = getExceptionTraceAsString($exception);
        $filename = substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/'));
        $lineToWrite = "{$time} {$ip}  /{$appid}/ {$detail}\n" . $stack;
        $file = fopen(IAUTH_ERROR_LOG_FILE, 'a');
        if ($file) {
            fwrite($file, $lineToWrite);
            fclose($file);
        }
    } else {
        $stack = base64_encode(getExceptionTraceAsString($exception));
        SQL("INSERT error_log (error_time, error_ip, error_appid, error_message, error_detail, error_stack ) VALUES ('{$time}', '{$ip}', '{$appid}', '{$msg}', '{$detail}', '{$stack}' )");
    }
    return $msg;
    //.print_r($_SERVER,true);
}