isbkch/laravel5-tail

Laravel 5 的 tail 命令

1.4.0 2018-10-25 14:53 UTC

This package is auto-updated.

Last update: 2024-09-10 10:52:21 UTC


README

本包为 Laravel 5 添加 tail 命令。此包适用于日常和单日志,并支持本地和远程日志的 tail。

安装

您可以通过 composer 安装此包

composer require isbkch/laravel5-tail

您必须安装此服务提供者

// config/app.php

'providers' => [
    ...
    Isbkch\Tail\TailServiceProvider::class,
    ...
];

如果您计划 tail 远程日志,您必须使用以下命令发布配置文件

php artisan vendor:publish --provider="Isbkch\Tail\TailServiceProvider"

将在配置目录中创建一个名为 tail.php 的文件。文件中您可以设置的选项应该是显而易见的。PS:您可以从 .env 文件中获取用户名

return [


    'connections' => [

        /*
         * The environment name. You can use this value in the tail command.
         */
        'production' => [

             // Hostname of the server where the logs are located
            'host' => '',


             // Username to be used when connecting to the server where the logs are located
            'user'  => env('TAIL_USERNAME', 'isbkch'),

             // Full path to the directory where the logs are located
            'logDirectory' => '',
        ],

        // Change it to 'true' if you have grc (Generic Colouriser) installed in your system
        // To install grc on Debian based: sudo apt-get install grc
        'grc' => 'false'
    ],
];

使用方法

要 tail 本地日志,可以使用此命令

php artisan tail

默认情况下将显示最后 20 行。您可以使用 lines 选项更改该数字。

php artisan tail --lines=50

要 tail 远程日志,您必须在配置文件中首先指定 hostnamelogDirectory。完成此操作后,您可以指定环境作为参数来 tail 远程日志。

php artisan tail production

鸣谢

许可证

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