added quiet option
This commit is contained in:
parent
ccb3479568
commit
9474a9ebef
|
@ -8,8 +8,12 @@ use App\Repository\DomainRepository;
|
|||
use App\Repository\DynDNSRepository;
|
||||
use DI\Container;
|
||||
use DI\ContainerBuilder;
|
||||
use DI\DependencyException;
|
||||
use DI\NotFoundException;
|
||||
use Exception;
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Level;
|
||||
use Monolog\Logger;
|
||||
use function DI\autowire;
|
||||
|
||||
|
@ -23,9 +27,9 @@ class BindAPI
|
|||
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($verbose = false)
|
||||
public function __construct($verbose = false, $quiet = false)
|
||||
{
|
||||
// init the logger
|
||||
$dateFormat = "Y:m:d H:i:s";
|
||||
|
@ -34,9 +38,9 @@ class BindAPI
|
|||
|
||||
$debug = (new ConfigController)->getConfig(configKey: 'debug');
|
||||
if ($debug) {
|
||||
$stream = new StreamHandler(stream: dirname(path: __DIR__, levels: 2) . '/bindAPI.log', level: Logger::DEBUG);
|
||||
$stream = new StreamHandler(stream: dirname(path: __DIR__, levels: 2) . '/bindAPI.log', level: Level::Debug);
|
||||
} else {
|
||||
$stream = new StreamHandler(stream: dirname(path: __DIR__, levels: 2) . '/bindAPI.log', level: Logger::INFO);
|
||||
$stream = new StreamHandler(stream: dirname(path: __DIR__, levels: 2) . '/bindAPI.log', level: Level::Info);
|
||||
}
|
||||
$stream->setFormatter(formatter: $formatter);
|
||||
|
||||
|
@ -48,6 +52,7 @@ class BindAPI
|
|||
$containerBuilder = new ContainerBuilder();
|
||||
$containerBuilder->addDefinitions([
|
||||
ConfigController::class => autowire()
|
||||
->constructorParameter(parameter: 'quiet', value: $quiet)
|
||||
->constructorParameter(parameter: 'verbose', value: $verbose),
|
||||
CLIController::class => autowire()
|
||||
->constructorParameter(parameter: 'logger', value: $this->logger),
|
||||
|
@ -65,8 +70,8 @@ class BindAPI
|
|||
|
||||
|
||||
/**
|
||||
* @throws \DI\DependencyException
|
||||
* @throws \DI\NotFoundException
|
||||
* @throws DependencyException
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function runCommand(array $arguments): void
|
||||
{
|
||||
|
@ -77,8 +82,8 @@ class BindAPI
|
|||
|
||||
|
||||
/**
|
||||
* @throws \DI\DependencyException
|
||||
* @throws \DI\NotFoundException
|
||||
* @throws DependencyException
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function handleRequest(string $requestMethod, array $uri): void
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue