├── .github ├── FUNDING.yml └── workflows │ ├── php-cs-fixer.yml │ ├── run-tests.yml │ └── update-changelog.yml ├── .gitignore ├── .php_cs.dist.php ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── composer.json ├── config └── tail.php ├── phpunit.xml.dist ├── src ├── TailCommand.php └── TailServiceProvider.php └── tests ├── TailCommandTest.php └── TestCase.php /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://spatie.be/open-source/support-us 2 | -------------------------------------------------------------------------------- /.github/workflows/php-cs-fixer.yml: -------------------------------------------------------------------------------- 1 | name: Check & fix styling 2 | 3 | on: [push] 4 | 5 | jobs: 6 | php-cs-fixer: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout code 11 | uses: actions/checkout@v2 12 | with: 13 | ref: ${{ github.head_ref }} 14 | 15 | - name: Run PHP CS Fixer 16 | uses: docker://oskarstark/php-cs-fixer-ga 17 | with: 18 | args: --config=.php_cs.dist.php --allow-risky=yes 19 | 20 | - name: Commit changes 21 | uses: stefanzweifel/git-auto-commit-action@v4 22 | with: 23 | commit_message: Fix styling 24 | -------------------------------------------------------------------------------- /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | name: run-tests 2 | 3 | on: 4 | push: 5 | pull_request: 6 | schedule: 7 | - cron: '0 0 * * *' 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | php: [8.4, 8.3, 8.2, 8.1, 8.0] 17 | laravel: ['8.*', '9.*', '10.*', '11.*', '12.*'] 18 | dependency-version: [prefer-stable] 19 | include: 20 | - laravel: 10.* 21 | testbench: ^8.0 22 | - laravel: 9.* 23 | testbench: ^7.0 24 | - laravel: 8.* 25 | testbench: ^6.23 26 | - laravel: 11.* 27 | testbench: ^9.0 28 | - laravel: 12.* 29 | testbench: ^10.0 30 | exclude: 31 | - laravel: 10.* 32 | php: 8.0 33 | - laravel: 11.* 34 | php: 8.1 35 | - laravel: 11.* 36 | php: 8.0 37 | - laravel: 12.* 38 | php: 8.1 39 | - laravel: 12.* 40 | php: 8.0 41 | 42 | name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} 43 | 44 | steps: 45 | - name: Checkout code 46 | uses: actions/checkout@v2 47 | 48 | - name: Setup PHP 49 | uses: shivammathur/setup-php@v2 50 | with: 51 | php-version: ${{ matrix.php }} 52 | extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick 53 | coverage: none 54 | 55 | - name: Install dependencies 56 | run: | 57 | composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update 58 | composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest 59 | 60 | - name: Execute tests 61 | run: vendor/bin/phpunit 62 | -------------------------------------------------------------------------------- /.github/workflows/update-changelog.yml: -------------------------------------------------------------------------------- 1 | name: "Update Changelog" 2 | 3 | on: 4 | release: 5 | types: [released] 6 | 7 | jobs: 8 | update: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Checkout code 13 | uses: actions/checkout@v2 14 | with: 15 | ref: main 16 | 17 | - name: Update Changelog 18 | uses: stefanzweifel/changelog-updater-action@v1 19 | with: 20 | latest-version: ${{ github.event.release.name }} 21 | release-notes: ${{ github.event.release.body }} 22 | 23 | - name: Commit updated CHANGELOG 24 | uses: stefanzweifel/git-auto-commit-action@v4 25 | with: 26 | branch: main 27 | commit_message: Update CHANGELOG 28 | file_pattern: CHANGELOG.md 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.phar 3 | composer.lock 4 | .php_cs.cache 5 | .php-cs-fixer.cache 6 | -------------------------------------------------------------------------------- /.php_cs.dist.php: -------------------------------------------------------------------------------- 1 | in([ 5 | __DIR__ . '/src', 6 | __DIR__ . '/tests', 7 | ]) 8 | ->name('*.php') 9 | ->notName('*.blade.php') 10 | ->ignoreDotFiles(true) 11 | ->ignoreVCS(true); 12 | 13 | return (new PhpCsFixer\Config()) 14 | ->setRules([ 15 | '@PSR12' => true, 16 | 'array_syntax' => ['syntax' => 'short'], 17 | 'ordered_imports' => ['sort_algorithm' => 'alpha'], 18 | 'no_unused_imports' => true, 19 | 'not_operator_with_successor_space' => true, 20 | 'trailing_comma_in_multiline' => true, 21 | 'phpdoc_scalar' => true, 22 | 'unary_operator_spaces' => true, 23 | 'binary_operator_spaces' => true, 24 | 'blank_line_before_statement' => [ 25 | 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], 26 | ], 27 | 'phpdoc_single_line_var_spacing' => true, 28 | 'phpdoc_var_without_name' => true, 29 | 'class_attributes_separation' => [ 30 | 'elements' => [ 31 | 'method' => 'one', 32 | ], 33 | ], 34 | 'method_argument_space' => [ 35 | 'on_multiline' => 'ensure_fully_multiline', 36 | 'keep_multiple_spaces_after_comma' => true, 37 | ], 38 | 'single_trait_insert_per_statement' => true, 39 | ]) 40 | ->setFinder($finder); 41 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `laravel-tail` will be documented in this file 4 | 5 | ## 4.5.1 - 2025-02-21 6 | 7 | ### What's Changed 8 | 9 | * Laravel 12.x Compatibility by @laravel-shift in https://github.com/spatie/laravel-tail/pull/75 10 | 11 | **Full Changelog**: https://github.com/spatie/laravel-tail/compare/4.5.0...4.5.1 12 | 13 | ## 4.5.0 - 2024-02-29 14 | 15 | ### What's Changed 16 | 17 | * Laravel 11.x Compatibility by @laravel-shift in https://github.com/spatie/laravel-tail/pull/74 18 | 19 | **Full Changelog**: https://github.com/spatie/laravel-tail/compare/4.4.2...4.5.0 20 | 21 | ## 4.4.2 - 2023-01-25 22 | 23 | - support L10 24 | 25 | ## 4.4.1 - 2023-01-25 26 | 27 | - support L10 28 | 29 | ## 4.4.0 - 2022-01-13 30 | 31 | - support Laravel 9 32 | 33 | ## 4.3.4 - 2021-12-21 34 | 35 | ## What's Changed 36 | 37 | - Update README.md by @mansoorkhan96 in https://github.com/spatie/laravel-tail/pull/66 38 | - Symfony v6 by @Nielsvanpach in https://github.com/spatie/laravel-tail/pull/67 39 | 40 | ## New Contributors 41 | 42 | - @mansoorkhan96 made their first contribution in https://github.com/spatie/laravel-tail/pull/66 43 | - @Nielsvanpach made their first contribution in https://github.com/spatie/laravel-tail/pull/67 44 | 45 | **Full Changelog**: https://github.com/spatie/laravel-tail/compare/4.3.3...4.3.4 46 | 47 | ## 4.3.3 - 2021-07-04 48 | 49 | - prefix all shell commands with backslashes to ignore aliases (#65) 50 | 51 | ## 4.3.2 - 2021-01-25 52 | 53 | - use package service provider 54 | 55 | ### 4.3.1 - 2020-11-28 56 | 57 | - add support for PHP 8 58 | 59 | ### 4.3.0 - 2020-10-01 60 | 61 | - add file option (#63) 62 | 63 | ### 4.2.2 - 2020-09-09 64 | 65 | - Support Laravel 8 66 | 67 | ### 4.2.1 - 2020-06-08 68 | 69 | - fix `--grep` option (#60) 70 | 71 | ### 4.2.0 - 2020-03-03 72 | 73 | - add support for Laravel 7 74 | 75 | ### 4.1.0 - 2020-02-23 76 | 77 | - add `grep` option 78 | 79 | ### 4.0.0 - 2020-02-14 80 | 81 | - add option to tail remotely 82 | 83 | ### 3.3.0 - 2019-09-04 84 | 85 | - add support for Laravel 6 86 | 87 | ### 3.2.4 - 2019-02-26 88 | 89 | - add support for Laravel 5.8 90 | 91 | ### 3.2.3 - 2018-08-20 92 | 93 | - add `provides` to service provider 94 | 95 | ### 3.2.2 - 2018-08-20 96 | 97 | **THIS VERSION DOES NOT WORK, DO NOT USE** 98 | 99 | - prevent the package from being loaded in every web request 100 | 101 | ### 3.2.1 - 2018-08-20 102 | 103 | - add support for Laravel 5.7 104 | 105 | ### 3.2.0 - 2018-08-20 106 | 107 | - add `--hide-stack-traces` option 108 | 109 | ### 3.1.0 - 2018-04-12 110 | 111 | - add `--clear` option 112 | 113 | ### 3.0.1 - 2018-02-07 114 | 115 | - fix deps 116 | 117 | ### 3.0.0 - 2018-02-07 118 | 119 | - don't display any initial output 120 | - add support for L5.6 121 | 122 | ### 2.0.1 - 2017-08-30 123 | 124 | - fix deps 125 | 126 | ### 2.0.0 - 2017-08-30 127 | 128 | - add support for Laravel 5.5 129 | - drop support for all older Laravel versions 130 | - drop support for remote tailing 131 | 132 | ### 1.4.2 - 2017-03-21 133 | 134 | - stabilize custom port support 135 | 136 | ### 1.4.1 - 2017-03-17 137 | 138 | - fix backwards compatibility issue when `port` is not set in config file 139 | 140 | ### 1.4.0 - 2017-03-16 141 | 142 | - add `port` to config file 143 | 144 | ### 1.3.0 - 2016-03-13 145 | 146 | - add `-l` option 147 | 148 | ### 1.2.0 149 | 150 | - Make compatible with Laravel 5.4, drop support for all older versions 151 | 152 | ### 1.1.5 153 | 154 | - Remove L5.4 compatibility 155 | 156 | ### 1.1.4 157 | 158 | **THIS RELEASE CONTAINS BUGS, DO NOT USE** 159 | 160 | - Make compatible with Laravel 5.4 161 | 162 | ### 1.1.3 - 2016-11-26 163 | 164 | - Cleanup 165 | 166 | ### 1.1.2 167 | 168 | - Fix config file 169 | 170 | ### 1.1.1 171 | 172 | - Move repo from freekmurze to spatie 173 | 174 | ### 1.1.0 175 | 176 | - Add support for tailing remote logs 177 | 178 | ### 1.0.0 179 | 180 | - Initial release 181 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Spatie bvba 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Easily tail your logs 2 | 3 | [![Latest Version](https://img.shields.io/github/release/spatie/laravel-tail.svg?style=flat-square)](https://github.com/spatie/laravel-tail/releases) 4 | [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) 5 | [![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-tail.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-tail) 6 | 7 | This package offers an artisan command to tail the application log. It supports daily and single logs on your local machine. 8 | 9 | To tail the log you can use this command: 10 | 11 | ```bash 12 | php artisan tail 13 | ``` 14 | 15 | It can also tail logs on other environments: 16 | 17 | ```bash 18 | php artisan tail production 19 | ``` 20 | 21 | ## Support us 22 | 23 | [](https://spatie.be/github-ad-click/laravel-tail) 24 | 25 | We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). 26 | 27 | We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards). 28 | 29 | ## Installation 30 | 31 | You can install the package via composer: 32 | 33 | ``` bash 34 | composer require spatie/laravel-tail 35 | ``` 36 | 37 | You can publish the config file with: 38 | ```bash 39 | php artisan vendor:publish --provider="Spatie\Tail\TailServiceProvider" 40 | ``` 41 | 42 | This is the contents of the file that will be published at `config/tail.php`: 43 | 44 | ```php 45 | return [ 46 | 'production' => [ 47 | 48 | /* 49 | * The host that contains your logs. 50 | */ 51 | 'host' => env('TAIL_HOST_PRODUCTION', ''), 52 | 53 | /* 54 | * The user to be used to SSH to the server. 55 | */ 56 | 'user' => env('TAIL_USER_PRODUCTION', ''), 57 | 58 | /* 59 | * The path to the directory that contains your logs. 60 | */ 61 | 'log_directory' => env('TAIL_LOG_DIRECTORY_PRODUCTION', ''), 62 | 63 | /* 64 | * The filename of the log file that you want to tail. 65 | * Leave null to let the package automatically select the file. 66 | */ 67 | 'file' => env('TAIL_LOG_FILE_PRODUCTION', null), 68 | 69 | ], 70 | ]; 71 | ``` 72 | 73 | ## Usage 74 | 75 | To tail the local log you can use this command: 76 | 77 | ```bash 78 | php artisan tail 79 | ``` 80 | 81 | You can start the output with displaying the last lines in the log by using the `lines`-option. 82 | 83 | ```bash 84 | php artisan tail --lines=50 85 | ``` 86 | 87 | By default, the most-recently modified file in the directory will be used. 88 | You can specify the file that you would like to tail by using the `file` option. 89 | 90 | ```bash 91 | php artisan tail --file="other-file.log" 92 | ``` 93 | 94 | It's also possible to fully clear the output buffer after each log item. 95 | This can be useful if you're only interested in the last log entry when debugging. 96 | 97 | ```bash 98 | php artisan tail --clear 99 | ``` 100 | 101 | Should you wish to filter the log to return only certain keywords then you can also use the grep feature. 102 | 103 | ```bash 104 | php artisan tail --grep="only display lines that contain this string" 105 | ``` 106 | 107 | ### Tailing remote logs 108 | 109 | To tail remote logs, you must first specify values for `host`, `user`, `log_directory`, and `file` keys of an environment in the `tail` config file. 110 | 111 | After that you can tail that logs of an environment like this 112 | 113 | ```bash 114 | php artisan tail production 115 | ``` 116 | 117 | You can also use the `--clear`, `--file`, and `--lines` options described above. 118 | 119 | ### Changelog 120 | 121 | Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. 122 | 123 | ## Contributing 124 | 125 | Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details. 126 | 127 | ## Security 128 | 129 | If you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker. 130 | 131 | ## Credits 132 | 133 | - [Freek Van der Herten](https://github.com/freekmurze) 134 | - [All Contributors](../../contributors) 135 | 136 | This package was created because [the awesome tail command present in Laravel 4](https://github.com/laravel/framework/blob/4.2/src/Illuminate/Foundation/Console/TailCommand.php) was dropped in Laravel 5. The tail command from this package is equivalent to Laravel's old one minus the remote tailing features. 137 | 138 | ## License 139 | 140 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 141 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spatie/laravel-tail", 3 | "description": "Easily tail application logs", 4 | "keywords": [ 5 | "laravel", 6 | "tail", 7 | "log", 8 | "laravel-tail", 9 | "development" 10 | ], 11 | "homepage": "https://github.com/spatie/laravel-tail", 12 | "license": "MIT", 13 | "authors": [ 14 | { 15 | "name": "Freek Van der Herten", 16 | "email": "freek@spatie.be", 17 | "homepage": "https://murze.be", 18 | "role": "Developer" 19 | } 20 | ], 21 | "require": { 22 | "php": "^8.0", 23 | "illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0", 24 | "illuminate/console": "^8.0|^9.0|^10.0|^11.0|^12.0", 25 | "symfony/process": "^5.0|^6.0|^7.0", 26 | "spatie/ssh": "^1.4", 27 | "spatie/laravel-package-tools": "^1.9" 28 | }, 29 | "require-dev": { 30 | "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0", 31 | "phpunit/phpunit": "^9.5|^10.5|^11.5.3", 32 | "mockery/mockery": "^1.4" 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "Spatie\\Tail\\": "src" 37 | } 38 | }, 39 | "autoload-dev": { 40 | "psr-4": { 41 | "Spatie\\Tail\\Tests\\": "tests" 42 | } 43 | }, 44 | "extra": { 45 | "laravel": { 46 | "providers": [ 47 | "Spatie\\Tail\\TailServiceProvider" 48 | ] 49 | } 50 | }, 51 | "minimum-stability": "dev", 52 | "prefer-stable": true 53 | } 54 | -------------------------------------------------------------------------------- /config/tail.php: -------------------------------------------------------------------------------- 1 | [ 5 | 6 | /* 7 | * The host that contains your logs. 8 | */ 9 | 'host' => env('TAIL_HOST_PRODUCTION', ''), 10 | 11 | /* 12 | * The user to be used to SSH to the server. 13 | */ 14 | 'user' => env('TAIL_USER_PRODUCTION', ''), 15 | 16 | /* 17 | * The path to the directory that contains your logs. 18 | */ 19 | 'log_directory' => env('TAIL_LOG_DIRECTORY_PRODUCTION', ''), 20 | 21 | /* 22 | * The filename of the log file that you want to tail. 23 | * Leave null to let the package automatically select the file to tail. 24 | */ 25 | 'file' => env('TAIL_LOG_FILE_PRODUCTION', null), 26 | 27 | ], 28 | ]; 29 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | src/ 6 | 7 | 8 | 9 | 10 | tests 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/TailCommand.php: -------------------------------------------------------------------------------- 1 | option('debug')) { 24 | $this->info($this->getTailCommand()); 25 | 26 | return; 27 | } 28 | 29 | $this->handleClearOption(); 30 | 31 | $environment = $this->argument('environment'); 32 | 33 | is_null($environment) 34 | ? $this->tailLocally() 35 | : $this->tailRemotely($environment); 36 | } 37 | 38 | protected function handleClearOption() 39 | { 40 | if (! $this->option('clear')) { 41 | return; 42 | } 43 | 44 | $this->output->write(sprintf("\033\143\e[3J")); 45 | } 46 | 47 | protected function tailLocally(): void 48 | { 49 | $logDirectory = storage_path('logs'); 50 | 51 | Process::fromShellCommandline($this->getTailCommand(), $logDirectory) 52 | ->setTty(true) 53 | ->setTimeout(null) 54 | ->run(function ($type, $line) { 55 | $this->handleClearOption(); 56 | 57 | $this->output->write($line); 58 | }); 59 | } 60 | 61 | protected function tailRemotely(string $environment): void 62 | { 63 | $environmentConfig = $this->getEnvironmentConfiguration($environment); 64 | 65 | Ssh::create($environmentConfig['user'], $environmentConfig['host']) 66 | ->configureProcess(fn (Process $process) => $process->setTty(true)) 67 | ->onOutput(function ($type, $line) { 68 | $this->handleClearOption(); 69 | 70 | $this->output->write($line); 71 | }) 72 | ->execute([ 73 | "cd {$environmentConfig['log_directory']}", 74 | $this->getTailCommand(), 75 | ]); 76 | } 77 | 78 | protected function getEnvironmentConfiguration(string $environment): array 79 | { 80 | $config = config('tail'); 81 | 82 | if (! isset($config[$environment])) { 83 | throw new Exception("No configuration set for environment `{$environment}`. Make sure this environment is specified in the `tail` config file!"); 84 | } 85 | 86 | return $config[$environment]; 87 | } 88 | 89 | public function getTailFile(): string 90 | { 91 | $environment = $this->argument('environment'); 92 | $environmentConfig = is_null($environment) 93 | ? [] 94 | : $this->getEnvironmentConfiguration($environment); 95 | 96 | return $this->option('file') 97 | ?? $environmentConfig['file'] 98 | ?? "`\\ls -t | \\head -1`"; 99 | } 100 | 101 | public function getTailCommand(): string 102 | { 103 | $grep = $this->option('grep') 104 | ? ' | \\grep "'.$this->option('grep').'"' 105 | : ''; 106 | $file = $this->getTailFile(); 107 | 108 | return '\\tail -f -n '.$this->option('lines').' "'.$file.'"'.$grep; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/TailServiceProvider.php: -------------------------------------------------------------------------------- 1 | name('laravel-tail') 14 | ->hasConfigFile() 15 | ->hasCommand(TailCommand::class); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/TailCommandTest.php: -------------------------------------------------------------------------------- 1 | expectExceptionMessageMatches('/^No configuration set/'); 11 | 12 | $this->artisan('tail', [ 13 | 'environment' => 'non-existing-environment', 14 | ]); 15 | } 16 | 17 | /** @test */ 18 | public function the_tail_command_is_correct() 19 | { 20 | $this 21 | ->artisan('tail', [ 22 | '--debug' => true, 23 | ]) 24 | ->expectsOutput('\\tail -f -n 0 "`\\ls -t | \\head -1`"'); 25 | } 26 | 27 | /** @test */ 28 | public function the_tail_command_with_file_is_correct() 29 | { 30 | $this 31 | ->artisan('tail', [ 32 | '--debug' => true, 33 | '--file' => 'file.log', 34 | ]) 35 | ->expectsOutput('\\tail -f -n 0 "file.log"'); 36 | } 37 | 38 | /** @test */ 39 | public function the_command_when_grepping_is_correct() 40 | { 41 | $this 42 | ->artisan('tail', [ 43 | '--debug' => true, 44 | '--grep' => 'test', 45 | ]) 46 | ->expectsOutput('\\tail -f -n 0 "`\\ls -t | \\head -1`" | \\grep "test"'); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 |