Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-12-05 00:09:07 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-12-05 00:09:07 +0300
commita26cf222ff29851440d71cc63df7b3f8650100d3 (patch)
treee6845d779550511ab518c874dbb4088f3435ef27 /config
parent7a9f70830a0d32fd56f381aac47d5ed64bf4ed7a (diff)
#6622 Logger refactoring: log in CLI
- follows the verbosity level - formatted with colors
Diffstat (limited to 'config')
-rw-r--r--config/cli.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/config/cli.php b/config/cli.php
new file mode 100644
index 0000000000..50c4d5d885
--- /dev/null
+++ b/config/cli.php
@@ -0,0 +1,29 @@
+<?php
+
+use Interop\Container\ContainerInterface;
+use Monolog\Logger;
+use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
+use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
+use Symfony\Component\Console\Output\OutputInterface;
+
+return array(
+
+ // Log
+ 'log.handlers' => array(
+ DI\link('Symfony\Bridge\Monolog\Handler\ConsoleHandler'),
+ ),
+ 'Symfony\Bridge\Monolog\Handler\ConsoleHandler' => DI\factory(function (ContainerInterface $c) {
+ // Override the default verbosity map to make it more verbose by default
+ $verbosityMap = array(
+ OutputInterface::VERBOSITY_NORMAL => Logger::INFO,
+ OutputInterface::VERBOSITY_VERBOSE => Logger::DEBUG,
+ OutputInterface::VERBOSITY_VERY_VERBOSE => Logger::DEBUG,
+ OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG,
+ );
+ $handler = new ConsoleHandler(null, true, $verbosityMap);
+ $handler->setFormatter(new ConsoleFormatter($c->get('log.console.format'), null, true, true));
+ return $handler;
+ }),
+ 'log.console.format' => '%start_tag%%level_name% %extra.class%[%datetime%]%end_tag% %message% %context% %extra%' . PHP_EOL,
+
+);