<?php

set_exception_handler( function (Exception $exception) {
    file_put_contents(__DIR__ . "/../logs/error.log",
        date("H:i:s F j, Y", $_SERVER['REQUEST_TIME']) .
        "\n{$exception->getMessage()}\n" .
        "{$exception->getFile()} \t Line: {$exception->getLine()}\n\n",
        FILE_APPEND);
    $timeout = 600;
    //Sending 503 header and loading error page template
    header("HTTP/1.1 503 Service Unavailable", true, $timeout);
    header("Retry-After: $timeout");
    require_once "../src/View/503.html";
});
