Recording Command Output
By default, Laritor captures basic information about Artisan commands, including their name, start and end times, exit code, and context. To also record a command’s output, enable it on that command with the SendOutputToLaritor trait.
Enable Command Output Recording
Section titled “Enable Command Output Recording”Add the trait to your console command class:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;use BinaryBuilds\LaritorClient\SendOutputToLaritor;
class ImportUsers extends Command{ use SendOutputToLaritor;
protected $signature = 'users:import'; protected $description = 'Import users from external service';
public function handle() { $this->info('Starting import...');
// Import logic here
$this->info('Import complete!'); }}Laritor will capture the command’s console output, including info, warn, error, comment, table, and other console messages, as part of the command event data.
When to Use It
Section titled “When to Use It”- Debugging failed or complex long-running commands.
- Correlating command logs with system events.