logs/live
< >

return function () {
    $self = url('/@object/@action/' . urlencode('logs/live'));
    $rate = is_string($_GET['rate'] ?? null) && ctype_digit($_GET['rate']) ? max(1, min(200, (int) $_GET['rate'])) : 3;
    $ls = _class('admin_log_stream');
    $src = clone _class('log_stream_source_demo', 'classes/log_stream/');
    $src->id = 'demo';
    $src->RATE = $rate;
    $base = $self . '?rate=' . $rate;
    if (($_GET['poll'] ?? '') === '1') {
        // the poll of this page: the token check, the session closed before the wait, JSON, the end of the request; the long-poll
        // (a held worker per request) only off the public site
        $ls->WAIT_SECONDS = defined('YF_PUBLIC_SITE') && YF_PUBLIC_SITE ? 0 : 5;
        $guard = _class('csrf_guard');
        $guard->LOG_ERRORS = false;
        return $ls->respond($src);
    }
    $intro = '<p class="docs-demo-intro">The live log view of the admin log pages (button <b>Live</b> on Admin activity, Audit log, the request, log-in and
        mail logs and the System logs), here on a synthetic log of ' . $rate . ' entries a second (<a href="' . _prepare_html($base === $self . '?rate=3' ? $self . '?rate=100' : $self . '?rate=3') . '">'
        . ($rate === 3 ? 'try 100 a second' : 'back to 3 a second') . '</a>). The page asks for the entries after its cursor at the interval of the ⟳ control (10 s until chosen, kept per page) and keeps at most
        the chosen number of rows; Pause keeps new entries aside and counts them, Follow stays at the newest, the text filter hides rows, the
        highlight marks them, the level and server filters narrow the list, and a row opens its details. Some entries carry a token in a URL,
        template braces or markup: they are masked and shown as text. Classes: <code>yf_admin_log_stream</code>, <code>yf_log_stream_source_*</code>,
        asset <code>yf_log_stream</code>.</p>';
    return $intro . $ls->page($src, ['poll' => $base . '&poll=1', 'title' => 'Demo log']);
};

The live log view of the admin log pages (button Live on Admin activity, Audit log, the request, log-in and mail logs and the System logs), here on a synthetic log of 100 entries a second (back to 3 a second). The page asks for the entries after its cursor at the interval of the ⟳ control (10 s until chosen, kept per page) and keeps at most the chosen number of rows; Pause keeps new entries aside and counts them, Follow stays at the newest, the text filter hides rows, the highlight marks them, the level and server filters narrow the list, and a row opens its details. Some entries carry a token in a URL, template braces or markup: they are masked and shown as text. Classes: yf_admin_log_stream, yf_log_stream_source_*, asset yf_log_stream.

Demo log live

Connecting