Convert Figma logo to code with AI

opcodesio logolog-viewer

Fast and beautiful Log Viewer for Laravel

3,454
243
3,454
9

Top Related Projects

:dromedary_camel: Laravel log viewer

:page_with_curl: Provides a log viewer for Laravel

Laravel N+1 Query Detector

Debugbar for Laravel (Integrates PHP Debug Bar)

Clockwork - php dev tools in your browser - server-side component

Quick Overview

Log Viewer is a Laravel package that provides a web-based interface for viewing and analyzing log files. It offers a user-friendly way to browse, search, and filter log entries, making it easier for developers and system administrators to troubleshoot issues and monitor application behavior.

Pros

  • Easy installation and integration with Laravel projects
  • Real-time log viewing with automatic updates
  • Advanced search and filtering capabilities
  • Customizable appearance and behavior

Cons

  • Limited to Laravel applications
  • May impact performance if used on large log files
  • Requires additional server resources to run
  • Potential security risk if not properly secured

Code Examples

  1. Basic usage in a Laravel route:
use Opcodes\LogViewer\Facades\LogViewer;

Route::get('/logs', function () {
    return LogViewer::getFiles();
});
  1. Customizing the log viewer configuration:
// In config/log-viewer.php
return [
    'route_path' => 'custom-logs',
    'back_to_system_url' => 'https://your-app.com/dashboard',
    'max_log_size' => 52428800, // 50MB
];
  1. Using the LogViewer facade to get log entries:
use Opcodes\LogViewer\Facades\LogViewer;

$entries = LogViewer::getFile('laravel.log')->getEntries();
foreach ($entries as $entry) {
    echo $entry->message;
}

Getting Started

  1. Install the package via Composer:
composer require opcodesio/log-viewer
  1. Publish the configuration file:
php artisan vendor:publish --provider="Opcodes\LogViewer\LogViewerServiceProvider"
  1. Access the log viewer in your browser:
http://your-app.com/log-viewer

Competitor Comparisons

:dromedary_camel: Laravel log viewer

Pros of laravel-log-viewer

  • Lightweight and simple to set up
  • Supports multiple log files out of the box
  • Includes a built-in authentication mechanism

Cons of laravel-log-viewer

  • Less feature-rich compared to log-viewer
  • Limited customization options
  • Lacks advanced filtering and search capabilities

Code Comparison

log-viewer:

use Opcodes\LogViewer\Facades\LogViewer;

LogViewer::get()->first()->getEntries()->search('error');

laravel-log-viewer:

use Rap2hpoutre\LaravelLogViewer\LaravelLogViewer;

$logs = LaravelLogViewer::all();

The code comparison shows that log-viewer offers more advanced functionality for searching and filtering log entries, while laravel-log-viewer provides a simpler API for accessing logs.

log-viewer generally offers a more comprehensive set of features, including real-time log tailing, advanced filtering, and a modern user interface. However, laravel-log-viewer may be preferred for simpler projects or when a lightweight solution is needed.

Both packages are actively maintained and have good community support, but log-viewer has seen more recent updates and improvements.

:page_with_curl: Provides a log viewer for Laravel

Pros of LogViewer

  • More mature project with longer development history
  • Offers additional features like log deletion and log archiving
  • Provides a command-line interface for managing logs

Cons of LogViewer

  • Less frequent updates and maintenance
  • User interface may feel outdated compared to log-viewer
  • Potentially more complex setup and configuration

Code Comparison

LogViewer:

use Arcanedev\LogViewer\Facades\LogViewer;

$logs = LogViewer::all();
$entries = LogViewer::entries($date, $level);

log-viewer:

use Opcodes\LogViewer\Facades\LogViewer;

$files = LogViewer::getFiles();
$entries = LogViewer::getEntries($file);

Both projects provide Laravel facades for easy integration, but their methods and usage differ slightly. LogViewer offers more granular control over log entries, while log-viewer focuses on simplicity and ease of use.

log-viewer is a more recent project with a modern UI and active development. It emphasizes simplicity and performance, making it easier to set up and use out of the box. However, LogViewer offers more advanced features for those who need fine-grained control over their log management.

Choose LogViewer if you need advanced log management features and don't mind a slightly more complex setup. Opt for log-viewer if you prefer a modern, user-friendly interface and simpler integration with your Laravel application.

Laravel N+1 Query Detector

Pros of Laravel Query Detector

  • Focuses specifically on detecting and alerting about N+1 queries, which can significantly impact performance
  • Provides real-time notifications in the browser console or as an alert, making it easier to spot issues during development
  • Lightweight and easy to integrate into existing Laravel projects

Cons of Laravel Query Detector

  • Limited to query detection and doesn't provide comprehensive log viewing capabilities
  • May not be as useful in production environments where browser-based alerts are not practical
  • Lacks advanced filtering and search features for analyzing query patterns

Code Comparison

Laravel Query Detector:

QueryDetector::logQuery($query, $bindings, $time);

Log Viewer:

use Opcodes\LogViewer\Facades\LogViewer;

LogViewer::getFiles();
LogViewer::getFile('laravel.log');

Summary

Laravel Query Detector is a specialized tool for identifying N+1 query issues in Laravel applications, offering real-time notifications during development. It's lightweight and easy to integrate but lacks comprehensive log viewing features.

Log Viewer, on the other hand, provides a more robust solution for viewing and analyzing various types of logs, including Laravel logs. It offers advanced filtering, search capabilities, and a user-friendly interface for log management.

The choice between these tools depends on the specific needs of the project. Laravel Query Detector is ideal for developers focused on optimizing database queries, while Log Viewer is better suited for overall log management and analysis in Laravel applications.

Debugbar for Laravel (Integrates PHP Debug Bar)

Pros of Laravel Debugbar

  • Provides real-time debugging information directly in the browser
  • Offers a wide range of metrics including database queries, request data, and memory usage
  • Integrates seamlessly with Laravel's built-in features and other popular packages

Cons of Laravel Debugbar

  • Can impact performance when enabled in production environments
  • May expose sensitive information if not properly configured
  • Requires manual setup and configuration for optimal use

Code Comparison

Laravel Debugbar:

use Barryvdh\Debugbar\Facade as Debugbar;

Debugbar::info('Info message');
Debugbar::error('Error message');
Debugbar::warning('Warning message');

Log Viewer:

use Illuminate\Support\Facades\Log;

Log::info('Info message');
Log::error('Error message');
Log::warning('Warning message');

Summary

Laravel Debugbar is a powerful tool for real-time debugging and performance analysis, offering a comprehensive set of metrics directly in the browser. However, it may impact performance and requires careful configuration to avoid security risks.

Log Viewer, on the other hand, focuses on providing a user-friendly interface for viewing and analyzing log files. It's lightweight and doesn't affect application performance, but lacks the real-time debugging capabilities of Laravel Debugbar.

The choice between these tools depends on specific project requirements and debugging preferences. Laravel Debugbar is ideal for detailed, real-time analysis during development, while Log Viewer is better suited for reviewing logs in both development and production environments.

Clockwork - php dev tools in your browser - server-side component

Pros of Clockwork

  • More comprehensive profiling and debugging capabilities, including database queries, cache operations, and events
  • Browser extension for Chrome and Firefox, providing a user-friendly interface for viewing profiling data
  • Supports multiple PHP frameworks, including Laravel, Lumen, and Slim

Cons of Clockwork

  • Requires more setup and configuration compared to Log Viewer
  • May have a higher performance overhead due to its extensive profiling features
  • Less focused on log viewing specifically, as it's a more general-purpose debugging tool

Code Comparison

Log Viewer:

use Opcodes\LogViewer\Facades\LogViewer;

LogViewer::get('laravel.log')->getEntries();

Clockwork:

use Clockwork\Support\Clockwork;

Clockwork::startEvent('event_name', 'Event description');
// Your code here
Clockwork::endEvent('event_name');

Summary

Log Viewer is a specialized tool for viewing and analyzing log files, while Clockwork is a more comprehensive debugging and profiling tool. Log Viewer is simpler to set up and use, focusing specifically on log management. Clockwork offers broader debugging capabilities but requires more configuration and may have a higher performance impact. The choice between the two depends on the specific needs of the project and the level of debugging detail required.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Log Viewer
Easy-to-use, fast, and beautiful

Documentation | Features | Installation | Troubleshooting | Credits

Packagist Packagist PHP from Packagist Laravel Version

log-viewer-light-dark

OPcodes's Log Viewer is a perfect companion for your Laravel app.

You will no longer need to read the raw Laravel log files (and other types of logs) trying to find what you're looking for.

Log Viewer helps you quickly and clearly see individual log entries, to search, filter, and make sense of your Laravel logs fast. It is free and easy to install.

📺 Watch a quick 4-minute video showcasing some Log Viewer features.

Features

  • 📂 View all the Laravel logs in your storage/logs directory,
  • 📂 View other types of logs - Horizon, Apache, Nginx, Redis, Supervisor, Postgres, and more,
  • 🔍 Search the logs,
  • 🎚 Filter by log level (error, info, debug, etc.),
  • 🔗 Sharable links to individual log entries,
  • 🌑 Dark mode,
  • 📱 Mobile-friendly UI,
  • 🖥️ Multiple host support,
  • ⌨️ Keyboard accessible,
  • 💾 Download & delete log files from the UI,
  • ☑️ Horizon log support (up to Horizon v9.20),
  • ☎️ API access for folders, files & log entries,
  • 💌 Mail previews for e-mails sent to the logs,
  • and more...

Documentation

Documentation can be found on the official website.

Get Started

Requirements

  • PHP 8.0+
  • Laravel 8+

Installation

To install the package via composer, Run:

composer require opcodesio/log-viewer

After installing the package, publish the front-end assets by running:

php artisan log-viewer:publish

Usage

Once the installation is complete, you will be able to access Log Viewer directly in your browser.

By default, the application is available at: {APP_URL}/log-viewer.

(for example: https://my-app.test/log-viewer)

Configuration

Please visit the Log Viewer Docs to learn about configuring Log Viewer to your needs.

Troubleshooting

Here are some common problems and solutions.

Problem: Logs not loading

Please see this page for support log formats. If your log has a custom format, or is not supported by Log Viewer out of the box, you will need to define your own custom log parser.

If your logs are still not showing up, make sure the web process, which Log Viewer runs on, has permission to read these logs.

For example, if you want to read the Apache HTTP access logs in /var/log/httpd, you will need to make sure that your web process (apache/httpd) has permission to read these files. On unix systems, you can do this with file ACLs.

Screenshots

Read the release blog post for screenshots and more information about Log Viewer's features.

The release of v2 includes a few new features in v2.

The release of v3 includes a few new features in v3.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.