-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add a new command `ClearCommand` to clear the Soar log file - The command is executed with the signature `soar:clear` - The log file is determined based on the configuration or the default path - Display success message after clearing the log file
- Loading branch information
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the guanguans/laravel-soar. | ||
* | ||
* (c) guanguans <ityaozm@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled. | ||
*/ | ||
|
||
namespace Guanguans\LaravelSoar\Commands; | ||
|
||
use Guanguans\LaravelSoar\Soar; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\File; | ||
|
||
class ClearCommand extends Command | ||
{ | ||
protected $signature = 'soar:clear'; | ||
|
||
protected $description = 'Clear the Soar log file'; | ||
|
||
public function handle(Soar $soar): void | ||
{ | ||
$this->info('Clearing Soar log file...'); | ||
|
||
$logFile = config('soar.options.-log-output') ?: \dirname($soar->getSoarPath()).'/soar.log'; | ||
File::delete($logFile); | ||
|
||
$this->info("The Soar log file($logFile) has been cleared."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters