mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
CLI parameters override log config, writer is STDERR
This commit is contained in:
parent
add8c4094b
commit
a3099c82f2
@ -30,14 +30,34 @@ class Cli extends ApplicationBootstrap
|
|||||||
|
|
||||||
protected $cliLoader;
|
protected $cliLoader;
|
||||||
|
|
||||||
|
protected $verbose;
|
||||||
|
|
||||||
|
protected $debug;
|
||||||
|
|
||||||
protected function bootstrap()
|
protected function bootstrap()
|
||||||
{
|
{
|
||||||
$this->assertRunningOnCli();
|
$this->assertRunningOnCli();
|
||||||
return $this->setupConfig()
|
$this->setupConfig()
|
||||||
|
->parseBasicParams()
|
||||||
|
->fixLoggingConfig()
|
||||||
->setupErrorHandling()
|
->setupErrorHandling()
|
||||||
->setupResourceFactory()
|
->setupResourceFactory()
|
||||||
->setupModules()
|
->setupModules()
|
||||||
->parseParams();
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function fixLoggingConfig()
|
||||||
|
{
|
||||||
|
$conf = & $this->getConfig()->logging;
|
||||||
|
if ($conf->type === 'stream') {
|
||||||
|
$conf->verbose = $this->verbose;
|
||||||
|
$conf->target = 'php://stderr';
|
||||||
|
}
|
||||||
|
if ($conf->debug && $conf->debug->type === 'stream') {
|
||||||
|
$conf->debug->target = 'php://stderr';
|
||||||
|
$conf->debug->enable = $this->debug;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cliLoader()
|
public function cliLoader()
|
||||||
@ -76,7 +96,7 @@ class Cli extends ApplicationBootstrap
|
|||||||
return $this->moduleManager;
|
return $this->moduleManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseParams()
|
protected function parseBasicParams()
|
||||||
{
|
{
|
||||||
$this->params = Params::parse();
|
$this->params = Params::parse();
|
||||||
if ($this->params->shift('help')) {
|
if ($this->params->shift('help')) {
|
||||||
@ -90,6 +110,9 @@ class Cli extends ApplicationBootstrap
|
|||||||
$this->watchTimeout = (int) $watch;
|
$this->watchTimeout = (int) $watch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->debug = (int) $this->params->get('debug');
|
||||||
|
$this->verbose = (int) $this->params->get('verbose');
|
||||||
|
|
||||||
$this->showBenchmark = (bool) $this->params->shift('benchmark');
|
$this->showBenchmark = (bool) $this->params->shift('benchmark');
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user