Skip to content
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

Improved the logger panel when the log context is very long #17852

Closed
wants to merge 4 commits into from

Conversation

javiereguiluz
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Problem

When the context of a log message is long, it's very hard to read it:

long_context

Solution

Add a toggle which displays the context properly formatted in several lines:

logger_expand_context

To avoid cluttering the logs, this toggle is only displayed for really long contexts. For example, these three short contexts don't display that link:

short_context

@HeahDude
Copy link
Contributor

Nice feature ! Thanks

@stof
Copy link
Member

stof commented Feb 19, 2016

👍

@linaori
Copy link
Contributor

linaori commented Feb 19, 2016

Very nice! Just today I fixed a log that put a massive array in the log message but adding it to the context wasn't much better in terms of readability (besides of being lighter of color).

@xabbuh
Copy link
Member

xabbuh commented Feb 20, 2016

👍

Status: Reviewed

@fabpot
Copy link
Member

fabpot commented Feb 20, 2016

I find it weird to have a JSON representation for the inline log and a pseudo-PHP one for the expanded view.

@javiereguiluz
Copy link
Member Author

I think @fabpot is right. I'd like to display the original JSON expanded, formatted and highlighted.

Would you agree with including a client-side highlighter in the profiler? (I'm thinking about highlight.js) We could reuse it to highlight SQL queries (removing our custom highlighter), other log files, etc.

@fabpot
Copy link
Member

fabpot commented Feb 22, 2016

I would do the opposite and always display a PHP-like output, that's much easier.

@javiereguiluz
Copy link
Member Author

I've updated the PR to always display pseudo-PHP:

Short contexts

short_contexts

Long contexts (expanded)

long_context_expanded


If you like, we could even hide the full context when is very long:

Before

before_logs

After

after_logs

@fabpot
Copy link
Member

fabpot commented Feb 22, 2016

I like the second version.

@javiereguiluz
Copy link
Member Author

Updated. Let's recap the new behavior:

Short context (<= 120 chars)

Full context is displayed and no link is added:

short_context

Long context (> 120 chars)

Only the first 120 chars are displayed and a Show full context link is added:

long_context_hidden

When clicked, the full context is shown formatted in several lines:

long_context_shown

@fabpot
Copy link
Member

fabpot commented Feb 22, 2016

👍

@fabpot
Copy link
Member

fabpot commented Mar 2, 2016

Thank you @javiereguiluz.

@fabpot fabpot closed this Mar 2, 2016
fabpot added a commit that referenced this pull request Mar 2, 2016
… long (javiereguiluz)

This PR was squashed before being merged into the 3.1-dev branch (closes #17852).

Discussion
----------

Improved the logger panel when the log context is very long

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

### Problem

When the context of a log message is long, it's very hard to read it:

![long_context](https://cloud.githubusercontent.com/assets/73419/13177340/d0205bbe-d718-11e5-9ba4-243aea0358bb.png)

### Solution

Add a toggle which displays the context properly formatted in several lines:

![logger_expand_context](https://cloud.githubusercontent.com/assets/73419/13177347/e12a723c-d718-11e5-8461-f1827d6dcd8c.gif)

To avoid cluttering the logs, this toggle is only displayed for really long contexts. For example, these three short contexts don't display that link:

![short_context](https://cloud.githubusercontent.com/assets/73419/13177374/fc9f97cc-d718-11e5-8245-8b308c48ebcf.png)

Commits
-------

33f0e5e Improved the logger panel when the log context is very long
@fabpot fabpot mentioned this pull request May 13, 2016
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull request Mar 25, 2018
…is very long (javiereguiluz)

This PR was squashed before being merged into the 3.1-dev branch (closes symfony#17852).

Discussion
----------

Improved the logger panel when the log context is very long

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

### Problem

When the context of a log message is long, it's very hard to read it:

![long_context](https://cloud.githubusercontent.com/assets/73419/13177340/d0205bbe-d718-11e5-9ba4-243aea0358bb.png)

### Solution

Add a toggle which displays the context properly formatted in several lines:

![logger_expand_context](https://cloud.githubusercontent.com/assets/73419/13177347/e12a723c-d718-11e5-8461-f1827d6dcd8c.gif)

To avoid cluttering the logs, this toggle is only displayed for really long contexts. For example, these three short contexts don't display that link:

![short_context](https://cloud.githubusercontent.com/assets/73419/13177374/fc9f97cc-d718-11e5-8245-8b308c48ebcf.png)

Commits
-------

33f0e5e Improved the logger panel when the log context is very long
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.

None yet

7 participants