1
0
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:
Taylor Otwell
2016-09-21 09:52:12 -05:00
parent b52f463ecb
commit a058c1251e
3 changed files with 0 additions and 48 deletions

View File

@@ -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.
*

View File

@@ -158,23 +158,6 @@
}
})->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.
*/

View File

@@ -64,14 +64,6 @@ public function test_prune_links_removes_broken_symlinks_in_sites_path()
$site->pruneLinks();
$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');
}
}