mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
remove logs method
This commit is contained in:
@@ -235,29 +235,6 @@ function unsecure($url)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all of the log files for all sites.
|
|
||||||
*
|
|
||||||
* @param array $paths
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function logs($paths)
|
|
||||||
{
|
|
||||||
$files = collect();
|
|
||||||
|
|
||||||
foreach ($paths as $path) {
|
|
||||||
$files = $files->merge(collect($this->files->scandir($path))->map(function ($directory) use ($path) {
|
|
||||||
$logPath = $path.'/'.$directory.'/storage/logs/laravel.log';
|
|
||||||
|
|
||||||
if ($this->files->isDir(dirname($logPath))) {
|
|
||||||
return $this->files->touchAsUser($logPath);
|
|
||||||
}
|
|
||||||
})->filter());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $files->values()->all();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to the linked Valet sites.
|
* Get the path to the linked Valet sites.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -158,23 +158,6 @@
|
|||||||
}
|
}
|
||||||
})->descriptions('Determine which Valet driver serves the current working directory');
|
})->descriptions('Determine which Valet driver serves the current working directory');
|
||||||
|
|
||||||
/**
|
|
||||||
* Stream all of the logs for all sites.
|
|
||||||
*/
|
|
||||||
$app->command('logs', function () {
|
|
||||||
$files = Site::logs(Configuration::read()['paths']);
|
|
||||||
|
|
||||||
$args = collect($files)->map(function ($file) {
|
|
||||||
return escapeshellarg($file);
|
|
||||||
})->implode(' ');
|
|
||||||
|
|
||||||
if (count($files) > 0) {
|
|
||||||
passthru("tail -f {$args}");
|
|
||||||
} else {
|
|
||||||
warning('No log files were found.');
|
|
||||||
}
|
|
||||||
})->descriptions('Stream all of the logs for all Laravel sites registered with Valet');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stream the Caddy access and error logs.
|
* Stream the Caddy access and error logs.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -64,14 +64,6 @@ public function test_prune_links_removes_broken_symlinks_in_sites_path()
|
|||||||
$site->pruneLinks();
|
$site->pruneLinks();
|
||||||
$this->assertFileNotExists(__DIR__.'/output/link');
|
$this->assertFileNotExists(__DIR__.'/output/link');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function test_logs_method_returns_array_of_log_files()
|
|
||||||
{
|
|
||||||
$logs = resolve(Site::class)->logs([__DIR__.'/test-directory-for-logs']);
|
|
||||||
$this->assertSame(__DIR__.'/test-directory-for-logs/project/storage/logs/laravel.log', $logs[0]);
|
|
||||||
unlink(__DIR__.'/test-directory-for-logs/project/storage/logs/laravel.log');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user