mojtabaahn/laravel-web-logs

此包已被废弃,不再维护。没有建议的替代包。

轻松访问Laravel/Lumen日志。

2.0.2 2022-05-26 20:11 UTC

README

Banner

在浏览器中查看Laravel/Lumen日志。

Packagist License Packagist Version GitHub repo size Packagist Downloads

免责声明

此包仅为Laravel和Lumen基于文件的日志的轻量级网络界面。如果您需要高级调试工具,请考虑尝试TelescopeDebugbarClockworkRay。如果您需要错误跟踪软件,请考虑尝试SentryBugsnag

屏幕截图

screen shot

安装

您可以通过composer安装此包

composer require mojtabaahn/laravel-web-logs

现在使用以下命令发布包资源

php artisan vendor:publish --tag="web-logs-assets"

可选地,您可以发布包的配置文件。

php artisan vendor:publish --provider="Mojtabaahn\LaravelWebLogs\Providers\LaravelWebLogsServiceProvider" --tag="config"

用法

访问web-logs/路由使用此包。您可以在配置文件中更改此设置。

配置

这是发布配置文件的内容

use Mojtabaahn\LaravelWebLogs\Http\Middlewares\Authorize;

return [

    /*
    |--------------------------------------------------------------------------
    | Dashboard Enabled
    |--------------------------------------------------------------------------
    |
    | Here you may specify either dashboard is enabled or not
    |
    */

    'enabled' => env('WEB_LOGS_ENABLED', true),

    /*
    |--------------------------------------------------------------------------
    | Route Group Attributes
    |--------------------------------------------------------------------------
    |
    | This is the array configuring package route attributes. feel free
    | to edit route prefixes, middlewares and anything else.
    |
    | In case you want to add authorization using default auth driver,
    | uncomment web middleware.
    |
    */

    'route_group_attributes' => [
        'prefix' => env('WEB_LOGS_PATH', 'web-logs'),
        'middleware' => [
            // 'web',
            Authorize::class,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Chunk Size
    |--------------------------------------------------------------------------
    |
    | On each request from dashboard to it's back-end how many logs should
    | it read of specified log file. Setting this option to a big number
    | may reduce dashboard performance!
    |
    */

    'chunk_size' => env('WEB_LOGS_CHUNK_SIZE', 10),

    /*
    |--------------------------------------------------------------------------
    | Search Path
    |--------------------------------------------------------------------------
    |
    | Use this property to customize logs directory where package should
    | look for log files.
    |
    */

    'search_path' => storage_path('logs'),
];

授权

Web Logs默认对所有用户和访客启用。如果您希望在访问之前授权用户,您必须注册一个viewWebLogs能力。一个好的地方是在Laravel附带的服务提供者AuthServiceProvider中这样做。

public function boot()
{
    $this->registerPolicies();

    Gate::define('viewWebLogs', function ($user = null) {
        // return true if access to web logs is allowed
    });
}

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件