Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tweaks to the Console logger#3721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 5 commits intosymfony:masterfromxabbuh:issue-3696-tweaks
Mar 26, 2014
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletionscomponents/console/logger.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand DownExpand Up@@ -63,20 +62,21 @@ You can rely on the logger to use this dependency inside a command::
{
$logger = new ConsoleLogger($output);

$myDependency = MyDependency($logger);
$myDependency =newMyDependency($logger);
$myDependency->doStuff();
}
}

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`` instance.
may not be sent to the :class:`Symfony\\Component\\Console\\Output\\OutputInterface`
instance.

By default, the console logger behaves like the
:doc:`Monolog's Console Handler </cookbook/logging/monolog_console>`.
Expand All@@ -99,10 +99,10 @@ 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,
);
$logger = new ConsoleLogger($output, array(), $formatLevelMap);

.. _PSR-3: http://www.php-fig.org/psr/psr-3/
.. _PSR-3: http://www.php-fig.org/psr/psr-3/
1 change: 1 addition & 0 deletionscomponents/map.rst.inc
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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**
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp