Skip to content

[DX] [HttpKernel] Use "context" argument when logging route in RouterListener #12594

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2015
Merged

[DX] [HttpKernel] Use "context" argument when logging route in RouterListener #12594

merged 1 commit into from
Jan 3, 2015

Conversation

linaori
Copy link
Contributor

@linaori linaori commented Nov 28, 2014

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

When using the "fingers_crossed" option, I only log stuff when a certain level is reached. I found the matched route with parameters to be extremely useful. The only problem was, that it gets dumped in a string, which reduces readability significantly when having multiple parameters.

I've used the context argument to provide the additional information so it becomes easier to read. Especially for formatters that use the context, such as the HtmlFormatter, can really use this.

I've done a quick check and noticed that almost always the information is dumped in the message, while I think it should be in the context. Is this something that should be changed in general?

@Tobion
Copy link
Contributor

Tobion commented Nov 28, 2014

👍 I also had this change on my todo list. IMO should be merged into 2.3

@fabpot
Copy link
Member

fabpot commented Jan 3, 2015

👍

@iltar I think it was done this way because those messages were created before the PSR. Moving stuff to the context is indeed a good idea. Can you work on another PR for 2.7? Thanks.

@fabpot
Copy link
Member

fabpot commented Jan 3, 2015

Thank you @iltar.

@fabpot fabpot merged commit 448c03f into symfony:2.7 Jan 3, 2015
fabpot added a commit that referenced this pull request Jan 3, 2015
…route in RouterListener (iltar)

This PR was merged into the 2.7 branch.

Discussion
----------

[DX] [HttpKernel] Use "context" argument when logging route in RouterListener

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

When using the "fingers_crossed" option, I only log stuff when a certain level is reached. I found the matched route with parameters to be extremely useful. The only problem was, that it gets dumped in a string, which reduces readability significantly when having multiple parameters.

I've used the context argument to provide the additional information so it becomes easier to read. Especially for formatters that use the context, such as the HtmlFormatter, can really use this.

*I've done a quick check and noticed that almost always the information is dumped in the message, while I think it should be in the context. Is this something that should be changed in general?*

Commits
-------

448c03f [HttpKernel] RouterListener uses "context" argument when logging route
@linaori
Copy link
Contributor Author

linaori commented Jan 3, 2015

@fabpot you mean this one for 2.3? This is merged into 2.7. Or were you pointing at the usages of the context?

@linaori linaori deleted the dx/controller-log branch January 3, 2015 10:42
@fabpot
Copy link
Member

fabpot commented Jan 3, 2015

@iltar Sorry, I meant doing another PR for other places where we could move parameters to the context instead of embedding them into a string.

@linaori
Copy link
Contributor Author

linaori commented Jan 3, 2015

I should be able to make some time next week(s), I'll submit a PR when done. Do you want me to base them off the 2.3 branch?

@fabpot
Copy link
Member

fabpot commented Jan 3, 2015

@iltar It should be done on 2.7. Thanks.

fabpot added a commit that referenced this pull request Jan 16, 2015
…rs (iltar)

This PR was squashed before being merged into the 2.7 branch (closes #13418).

Discussion
----------

[DX] Attempt to improve logging messages with  parameters

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12594 (comment)
| License       | MIT
| Doc PR        | n/a

This PR is a follow-up of #12594 `[DX] [HttpKernel] Use "context" argument when logging route in RouterListener`.

I have attempted to improve the log messages, as well as updating the usage context. I wasn't sure if the log messages should end with a `.` or not, if so I can update all messages to confirm a standard.

Commits
-------

ea80c9b [DX] Attempt to improve logging messages with  parameters
fabpot added a commit to symfony/event-dispatcher that referenced this pull request Jan 16, 2015
…rs (iltar)

This PR was squashed before being merged into the 2.7 branch (closes #13418).

Discussion
----------

[DX] Attempt to improve logging messages with  parameters

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

This PR is a follow-up of #12594 `[DX] [HttpKernel] Use "context" argument when logging route in RouterListener`.

I have attempted to improve the log messages, as well as updating the usage context. I wasn't sure if the log messages should end with a `.` or not, if so I can update all messages to confirm a standard.

Commits
-------

ea80c9b [DX] Attempt to improve logging messages with  parameters
fabpot added a commit to symfony/http-kernel that referenced this pull request Jan 16, 2015
…rs (iltar)

This PR was squashed before being merged into the 2.7 branch (closes #13418).

Discussion
----------

[DX] Attempt to improve logging messages with  parameters

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

This PR is a follow-up of #12594 `[DX] [HttpKernel] Use "context" argument when logging route in RouterListener`.

I have attempted to improve the log messages, as well as updating the usage context. I wasn't sure if the log messages should end with a `.` or not, if so I can update all messages to confirm a standard.

Commits
-------

ea80c9b [DX] Attempt to improve logging messages with  parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants