protected function fire()
{
$log = $this->argument('log');
$runtimePath = $this->storagePath . 'runtime/logs/';
$logPath = "{$runtimePath}{$log}.log";
if (!file_exists($runtimePath)) {
$this->error('Invalid log.');
return;
}
$args = '';
if ($this->option('lines')) {
$args .= ' -n ' . $this->option('lines');
} elseif ($this->option('blocks')) {
$args .= ' -b ' . $this->option('lines');
} elseif ($this->option('bytes')) {
$args .= ' -c ' . $this->option('bytes');
}
if ($this->option('reverse')) {
$args .= ' -r';
}
$command = sprintf('tail%s %s', $args, escapeshellarg($logPath));
passthru($command);
}