Nette log viewer - Developer tool for viewing and downloading Tracy log files.
- 📁 Browse log directory structure - Navigate through folders and files
- 👀 View log files - Syntax highlighting for better readability
- 🔍 Search in files - Find text with configurable context lines
- 📄 Pagination - Browse large directories (100 items per page) and files (100KB chunks)
- 💾 Download support - Download log files directly
- 🎨 HTML dumps - View Tracy exception dumps in iframe
- 🔐 Secure - Only accessible when Tracy debugger is enabled (debug mode)
Browse your log directory with pagination and search functionality.
View log files with syntax highlighting, pagination, and in-file search.
composer require liquiddesign/nette-log-viewerAdd routes to your config/pages.neon or similar configuration file:
routing:
routes:
'log-viewer/view/<file .+>': LogViewer:LogViewer:view
'log-viewer/download/<file .+>': LogViewer:LogViewer:download
'log-viewer[/<path .+>]': LogViewer:LogViewer:defaultIf you extended the presenter in your app namespace (e.g., App\Web\LogViewerPresenter):
routing:
routes:
'log-viewer/view/<file .+>': Web:LogViewer:view
'log-viewer/download/<file .+>': Web:LogViewer:download
'log-viewer[/<path .+>]': Web:LogViewer:defaultAlternatively, add the route in your RouterFactory:
// app/Router/RouterFactory.php
use LogViewer\LogViewerPresenter;
$router[] = new Route('log-viewer[/<action>][/<path .+>]', LogViewerPresenter::class);Navigate to:
https://your-app.com/log-viewer
Note: The log viewer is only accessible when Tracy debugger is enabled (debug mode). This is typically controlled by your config.neon:
parameters:
debugMode: %debugMode% # or specific IP addresses- Navigate through your log directory structure
- Search for files and folders by name
- Pagination for directories with many files (100 items per page)
- Sort by type (directories first) and name
- View text log files with syntax highlighting
- View HTML Tracy dumps in iframe
- Pagination for large files (100KB chunks)
- Search within files with configurable context (3-300 lines)
- Download any log file
By default, the log viewer uses Tracy\Debugger::$logDirectory. If you need a custom log directory, extend the presenter and override the log directory in startup():
namespace App\Web;
use LogViewer\LogViewerPresenter as BaseLogViewerPresenter;
class LogViewerPresenter extends BaseLogViewerPresenter
{
protected function startup(): void
{
parent::startup();
// Option 1: Use hardcoded path
$this->logDir = '/custom/path/to/logs';
// Option 2: Use container parameters (recommended)
$this->logDir = $this->container->getParameters()['tempDir'] . '/log';
}
}Then register your extended presenter in router configuration instead of the base one.
The package automatically restricts access to debug mode only. For additional security, you can extend the presenter and add custom access control:
namespace App\Web;
use LogViewer\LogViewerPresenter as BaseLogViewerPresenter;
use Nette\Application\ForbiddenRequestException;
class LogViewerPresenter extends BaseLogViewerPresenter
{
protected function startup(): void
{
parent::startup();
// Add custom access control (e.g., admin role required)
if (!$this->getUser()->isInRole('admin')) {
throw new ForbiddenRequestException();
}
}
}- PHP 8.3 or 8.4
- Nette Application 3.2+
- Nette Utils 4.0+
- Tracy 2.10+
# PHPStan analysis (level 8)
composer phpstan
# Code style check
composer phpcs
# Code style auto-fix
composer phpcsfixThe package is tested in production environment with Abel e-commerce platform.
Important: This package is a developer tool and should never be accessible in production. Always ensure:
- Tracy debugger is disabled in production
- Access is restricted by IP address or authentication
- Log files don't contain sensitive information
MIT License. See LICENSE file for details.
Developed by Liquid Design.
For issues and feature requests, please use GitHub Issues.