mirror of
https://github.com/laravel/valet.git
synced 2026-02-06 00:40:06 +01:00
Adds the option to view the Caddy access- and error-log using 'valet server-log'
This commit is contained in:
@@ -27,6 +27,7 @@ function install()
|
||||
$this->createDriversDirectory();
|
||||
$this->createSitesDirectory();
|
||||
$this->createExtensionsDirectory();
|
||||
$this->createLogDirectory();
|
||||
$this->writeBaseConfiguration();
|
||||
|
||||
$this->files->chown($this->path(), user());
|
||||
@@ -81,6 +82,18 @@ function createExtensionsDirectory()
|
||||
$this->files->ensureDirExists(VALET_HOME_PATH.'/Extensions', user());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the directory for Caddy log.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function createLogDirectory()
|
||||
{
|
||||
$this->files->ensureDirExists(VALET_HOME_PATH.'/Log', user());
|
||||
$this->files->touch(VALET_HOME_PATH.'/Log/access.log');
|
||||
$this->files->touch(VALET_HOME_PATH.'/Log/error.log');
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the base, initial configuration for Valet.
|
||||
*/
|
||||
|
||||
@@ -8,4 +8,20 @@ import VALET_HOME_PATH/Caddy/*
|
||||
rewrite {
|
||||
to /server.php?{query}
|
||||
}
|
||||
|
||||
log VALET_HOME_PATH/Log/access.log {
|
||||
rotate {
|
||||
size 10
|
||||
age 3
|
||||
keep 1
|
||||
}
|
||||
}
|
||||
|
||||
errors {
|
||||
log VALET_HOME_PATH/Log/error.log {
|
||||
size 10
|
||||
age 3
|
||||
keep 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,20 @@ https://VALET_SITE:443 {
|
||||
rewrite {
|
||||
to /server.php?{query}
|
||||
}
|
||||
|
||||
log VALET_HOME_PATH/Log/access.log {
|
||||
rotate {
|
||||
size 10
|
||||
age 3
|
||||
keep 1
|
||||
}
|
||||
}
|
||||
|
||||
errors {
|
||||
log VALET_HOME_PATH/Log/error.log {
|
||||
size 10
|
||||
age 3
|
||||
keep 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,6 +172,23 @@
|
||||
}
|
||||
})->descriptions('Stream all of the logs for all Laravel sites registered with Valet');
|
||||
|
||||
/**
|
||||
* Stream Caddy access- and error-log.
|
||||
*/
|
||||
$app->command('server-log', function () {
|
||||
$files = Filesystem::scandir(VALET_HOME_PATH.'/Log');
|
||||
|
||||
$files = collect($files)->transform(function ($file) {
|
||||
return escapeshellarg(VALET_HOME_PATH.'/Log/'.$file);
|
||||
})->all();
|
||||
|
||||
if (count($files) > 0) {
|
||||
passthru('tail -f '.implode(' ', $files));
|
||||
} else {
|
||||
warning('No log files were found.');
|
||||
}
|
||||
})->descriptions('Stream Caddy access- and error-log.');
|
||||
|
||||
/**
|
||||
* Display all of the registered paths.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user