Commit 9b111b2a authored by Jon Pugh's avatar Jon Pugh

Add logger to Context class and implement when writing configs.

parent 8cd03625
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "c8f06b1cc28f9638bdc92415ed78c328",
"content-hash": "25f4161ac19dde865bcef9fa9d341b03",
"packages": [
{
"name": "consolidation/annotated-command",
......
......@@ -6,6 +6,7 @@ use Drupal\Console\Core\Style\DrupalStyle;
use Symfony\Component\Console\Command\Command as BaseCommand;
use Drupal\Console\Core\Command\Shared\CommandTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\OutputInterface;
/**
......@@ -69,6 +70,7 @@ abstract class Command extends BaseCommand
// Load context from context_name argument.
$this->context_name = $this->input->getArgument('context_name');
$this->context = $this->getApplication()->getContext($this->context_name);
$this->context->logger = new ConsoleLogger($output);
}
catch (\Exception $e) {
......
......@@ -6,6 +6,7 @@
namespace Aegir\Provision;
use Psr\Log\LoggerInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Filesystem\Exception\IOException;
......@@ -48,7 +49,12 @@ class Context
* init(), set defaults with setProperty().
*/
protected $properties = [];
/**
* @var LoggerInterface
*/
public $logger;
/**
* Context constructor.
*
......
......@@ -38,6 +38,7 @@ class Service {
foreach ($this->getConfigurations()[$this->context->type] as $configuration_class) {
$config = new $configuration_class($this->context, $this);
$config->write();
$this->context->logger->notice('Wrote ' . $config->description . ' to ' . $config->filename());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment