Skip to content

Michael4d45/context-logging-filament-ui

Repository files navigation

Context Logging Filament UI

Filament 5 panel plugin that explores michael4d45/context-logging wide-event logs (Livewire, no React).

Status: 0.1.0 — suitable for trusted local/staging admin panels. Not a hardened multi-tenant production console yet.

Requirements

  • PHP 8.2+
  • Laravel 11–13
  • Filament 5
  • Wide-event JSON logs from michael4d45/context-logging (suggested)

Install

composer require michael4d45/context-logging-filament-ui

Register on a panel:

use Michael4d45\ContextLoggingFilamentUi\ContextLoggingFilamentUiPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(
            ContextLoggingFilamentUiPlugin::make()
                ->navigationLabel('Log Explorer')
                ->navigationSort(90)
                // ->canAccess(fn (): bool => auth()->user()?->isAdmin() ?? false)
        );
}

Theme CSS (@source)

Add the package Blade views to your Filament theme CSS, then rebuild Vite. Without this, Tailwind will purge almost all explorer classes and the UI will look broken:

@source '../../../../vendor/michael4d45/context-logging-filament-ui/resources/**/*.blade.php';

Publish config:

php artisan vendor:publish --tag=context-logging-filament-ui-config

Configure log paths

Set CONTEXT_LOG_FILAMENT_LOG_PATH (or edit config/context-logging-filament-ui.php) to the JSON log file(s) that contain wide events. There is no default path — pointing at a generic laravel.log usually shows nothing useful.

CONTEXT_LOG_FILAMENT_LOG_PATH=/var/www/html/storage/logs/context.log
CONTEXT_LOG_FILAMENT_ROOT_PATH=/var/www/html
CONTEXT_LOG_FILAMENT_CONTAINER_ROOT=/var/www/html
CONTEXT_LOG_FILAMENT_SPX_BASE_URL="${APP_URL}"
CONTEXT_LOG_FILAMENT_SPX_HTTP_KEY=dev

Docker / WSL source maps

Trace paths often look like /var/www/html/... inside a container. Set container_root to that prefix and root_path to the path PHP can read on the machine running the explorer so the source viewer can open files.

If you path-require this package via a Composer symlink, mount the package directory into every PHP/queue/Vite container that autoloads it, or you will get class-not-found / failed-to-open-stream noise.

Self-guard

When michael4d45/context-logging is installed in the same app, the plugin:

  1. Merges panel-aware path patterns into context-logging.log.ignore_routes
  2. Runs SuppressExplorerLogging middleware that calls ContextStore::suppressEmission() for explorer page loads, Livewire updates targeting the explorer, and SPX bridge/profile routes

So viewing logs should not emit new wide events for the viewer itself.

Features

  • Emit list, search, live poll (4s), pause
  • Optional auto-truncate (destructive; UI toggle, off by default)
  • Waterfall timeline
  • Experimental execution-path flame view (simplified; not full React parity)
  • Interactive SPX flamegraph + profile (client-fetched)
  • Typed event details, PHP/SQL highlighting, source/trace viewer

Security notes

  • Auto-truncate rewrites log files (keeps the newest half). Restrict panel access with canAccess().
  • SPX bridge/profile routes use the Filament panel auth middleware (not bare auth).
  • The SPX bridge proxies the configured spx_base_url for authenticated panel users — treat that config as trusted.

Config

See config/context-logging-filament-ui.php for apps, log paths, SPX, truncate threshold, and ignore patterns.

About

An admin view for your logs from the context logging package

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages