Skip to content

[Console] Added standalone PSR-3 compliant logger#3696

Merged
weaverryan merged 1 commit intosymfony:masterfrom
dunglas:console_logger
Mar 24, 2014
Merged

[Console] Added standalone PSR-3 compliant logger#3696
weaverryan merged 1 commit intosymfony:masterfrom
dunglas:console_logger

Conversation

@dunglas
Copy link
Copy Markdown
Member

@dunglas dunglas commented Mar 19, 2014

Q A
Doc fix? no
New docs? yes symfony/symfony#10194
Applies to 2.5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comma here since it does not hurt and they will copy paste so to reduce the diffs and for consistency too since you have used it above, i would also add them in the PR in symfony/symfony

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment for LogLevel, the namespace requirement question

@dunglas
Copy link
Copy Markdown
Member Author

dunglas commented Mar 19, 2014

@cordoval thanks, fixed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a parameter in the constructor

@dunglas
Copy link
Copy Markdown
Member Author

dunglas commented Mar 19, 2014

@cordoval done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the Logger (all words should be capitialized except from closed-class words)

@wouterj
Copy link
Copy Markdown
Member

wouterj commented Mar 19, 2014

Thank you for creating this. I've decorated it a bit more, after you fixed those, I think it's fine! :)

fabpot added a commit to symfony/symfony that referenced this pull request Mar 19, 2014
…glas)

This PR was merged into the 2.5-dev branch.

Discussion
----------

[Console] Added standalone PSR-3 compliant logger

This PR adds a standalone, PSR-3 compliant, logger to the Console component. It logs all messages on the console output. Messages of `DEBUG`, `INFO` and `NOTICE` levels are displayed using the `info` format (default to green). Higher levels are displayed using the `error` formatter (default to red).

This logger is similar to the [Monolog's Console Handler](http://symfony.com/doc/current/cookbook/logging/monolog_console.html) but does not have any external dependency (except `php-fig/log`). This is useful for console applications and commands needing a lightweight PSR-3 compliant logger (e.g. required by a dependency or to display basic informations to the user).

An usage example is available here: https://github.com/dunglas/php-schema.org-model/blob/master/src/SchemaOrgModel/Command/GenerateEntitiesCommand.php#L71

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | symfony/symfony-docs#3696

Commits
-------

e40b34d [Console] Added standalone PSR-3 compliant logger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants