From dd165898d2ea89718ee6fc1232f3eb44243f003f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 26 Mar 2014 10:35:55 +0100 Subject: [PATCH 1/5] add logger chapter to the component's map --- components/map.rst.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/components/map.rst.inc b/components/map.rst.inc index c3b88b548a9..9eb981425e3 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -23,6 +23,7 @@ * :doc:`/components/console/single_command_tool` * :doc:`/components/console/changing_default_command` * :doc:`/components/console/events` + * :doc:`/components/console/logger` * :doc:`/components/console/helpers/index` * **CssSelector** From 9b0911b2a4b44950d030d8039210a7c3d2c57392 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 26 Mar 2014 10:39:42 +0100 Subject: [PATCH 2/5] fix grammer mistake --- components/console/logger.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/console/logger.rst b/components/console/logger.rst index 84a41ad2b6c..6c54564963e 100644 --- a/components/console/logger.rst +++ b/components/console/logger.rst @@ -9,10 +9,9 @@ Using the Logger introduced in Symfony 2.5. The Console component comes with a standalone logger complying with the -`PSR-3_` standard. -Depending of the verbosity setting, log messages will be sent to the -:class:`Symfony\\Component\\Console\\Output\\OutputInterface` instance -passed as a parameter to the constructor. +`PSR-3_` standard. Depending on the verbosity setting, log messages will +be sent to the :class:`Symfony\\Component\\Console\\Output\\OutputInterface` +instance passed as a parameter to the constructor. The logger does not have any external dependency except ``php-fig/log``. This is useful for console applications and commands needing a lightweight @@ -76,7 +75,8 @@ Verbosity --------- Depending on the verbosity level that the command is run, messages may or -may not be sent to the ``Symfony\\Component\\Console\\Output\\OutputInterface`` instance. +may not be sent to the ``Symfony\\Component\\Console\\Output\\OutputInterface`` +instance. By default, the console logger behaves like the :doc:`Monolog's Console Handler `. @@ -105,4 +105,4 @@ constructor:: ); $logger = new ConsoleLogger($output, array(), $formatLevelMap); -.. _PSR-3: http://www.php-fig.org/psr/psr-3/ \ No newline at end of file +.. _PSR-3: http://www.php-fig.org/psr/psr-3/ From 3bbccf70bf27d0f32fa00fb395ff06a1b151450e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 26 Mar 2014 10:40:03 +0100 Subject: [PATCH 3/5] fix PSR-3 link as mentioned by @max-voloshin --- components/console/logger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/logger.rst b/components/console/logger.rst index 6c54564963e..35b72704044 100644 --- a/components/console/logger.rst +++ b/components/console/logger.rst @@ -9,7 +9,7 @@ Using the Logger introduced in Symfony 2.5. The Console component comes with a standalone logger complying with the -`PSR-3_` standard. Depending on the verbosity setting, log messages will +`PSR-3`_ standard. Depending on the verbosity setting, log messages will be sent to the :class:`Symfony\\Component\\Console\\Output\\OutputInterface` instance passed as a parameter to the constructor. From 83adc87e176ed9b194c06b727d4092ffb51737b5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 26 Mar 2014 10:43:37 +0100 Subject: [PATCH 4/5] fix class roles --- components/console/logger.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/logger.rst b/components/console/logger.rst index 35b72704044..71b8452b1d3 100644 --- a/components/console/logger.rst +++ b/components/console/logger.rst @@ -68,14 +68,14 @@ You can rely on the logger to use this dependency inside a command:: } The dependency will use the instance of -``Symfony\\Component\\Console\\Logger\\ConsoleLogger`` as logger. +:class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger` as logger. Log messages emitted will be displayed on the console output. Verbosity --------- Depending on the verbosity level that the command is run, messages may or -may not be sent to the ``Symfony\\Component\\Console\\Output\\OutputInterface`` +may not be sent to the :class:`Symfony\\Component\\Console\\Output\\OutputInterface` instance. By default, the console logger behaves like the From 610eb6b3910d6f7db3ecf787b2c86ef7a4d8e9b0 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 26 Mar 2014 10:46:38 +0100 Subject: [PATCH 5/5] code fixes as mentioned by @dirkluijk --- components/console/logger.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/logger.rst b/components/console/logger.rst index 71b8452b1d3..43951c63130 100644 --- a/components/console/logger.rst +++ b/components/console/logger.rst @@ -62,7 +62,7 @@ You can rely on the logger to use this dependency inside a command:: { $logger = new ConsoleLogger($output); - $myDependency = MyDependency($logger); + $myDependency = new MyDependency($logger); $myDependency->doStuff(); } } @@ -99,7 +99,7 @@ level. This behavior is configurable through the third parameter of the constructor:: // ... - private $formatLevelMap = array( + $formatLevelMap = array( LogLevel::CRITICAL => self::INFO, LogLevel::DEBUG => self::ERROR, );