-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Filter logs by level #24263
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
Filter logs by level #24263
Conversation
👍🏻 This is good :) |
@ro0NL I appreciate your efforts here a lot. I like the idea and I want to have this in Symfony ... but I don't like the implementation. Also, I think it's too late to make this right on time for Symfony 3.4 feature freeze. In my opinion, the interface should be like this: the table headers (Channel and Level) should be intelligent and include the following elements.
That's how I can easily filter log messages by any channel ... and it doesn't matter how many channels there are.
Something like this, but not so ugly: |
Well.. if we can filter by level and channel; that be awesome. I can imagine it's useful with lots of (user-defined) channels within the debug level. I like the slider approach; intuitively raising the log level. However this does not solve my real usecase; disable debug to expose what's critical. edit:
(Lets say "warning or higher", or only critical ;)) that's exactly what's needed yes. Your slider UI probably implies both points can be set, thats cool 🎉 |
Also see #24244 which improves the overall experience on heavy requests/logs panel, addresses #24263 (comment) |
var rows = document.querySelectorAll('table.logs tr[data-log-level="' + name + '"]'); | ||
for (var i = 0, row; row = rows[i]; ++i) { | ||
row.style.display = row.style.display == 'none' ? 'table-row' : 'none'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, you just faced vars hoisting ;P
anyway, please replace with:
document.querySelectorAll('table.logs tr[data-log-level="' + name + '"]').forEach(function(row) {
row.style.display = row.style.display === 'none' ? 'table-row' : 'none';
});
} | ||
</script> | ||
<div> | ||
{% for level in ['DEBUG', 'INFO', 'NOTICE', 'WARNING', 'ERROR', 'CRITICAL', 'ALERT', 'EMERGENCY'] %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shall not be hardcoded levels here.
i do know it's not likely to happen, but if one come up with other log level like "CONFIDENT" or "PERFORMANCE", he will need to be aware that he has to update template as well. not easy thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"he" will be SF core :) not our problem. Tend to be pragmatic here :) (for a poc at least). The PSR levels are not likely to change.
Yes. Your point is valid; open for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's long term issue. PSR could be change after 2 years, and nobody will remember after 2 years that some template has to be change due to that
<div> | ||
{% for level in ['DEBUG', 'INFO', 'NOTICE', 'WARNING', 'ERROR', 'CRITICAL', 'ALERT', 'EMERGENCY'] %} | ||
<input type="checkbox" id="log-level-{{ level }}" checked="checked" onclick="toggleLevel('{{ level }}');" /> | ||
<label for="log-level-{{ level }}">{{ level }}</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎 for hardcoding
in template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it looks good :) For now copied from somewhere else. Again, valid point :)
<label for="log-level-{{ level }}">{{ level }}</label> | ||
{% endfor %} | ||
</div> | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, damn, it's copy-pasted...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice idea @ro0NL 👍 ! |
@keradus comments addressed. For now all open :) as @javiereguiluz mentioned; this might be too simple. Yet as first step to proper log filtering i hope to see something in 3.4 yes. |
@ro0NL ( cc @javiereguiluz ) As I said in my issue #23038 early june, I think it could be a really cool tool (even in a simple implementation) for 3.4 launch Many thanks ! |
I like this. But... it's not mission critical and we don't want to release something that's not as polished as it could be. I tend to agree with @javiereguiluz when it comes to visual things. Though... is it possible to merge this before feature freeze and tweak the visuals after? @ro0NL would you be able to tweak the visuals like Javier talked about? Or would @javiereguiluz need to do that (and does he have the bandwidth... I'm terrible at design stuff) |
@weaverryan if we leave out channel filtering first, i might give this a try this weekend. So focus on the level filter, which is what this PR is about really :) (but filtering channels is valid, for sure). Hope to get @ogizanagi pov as welll, since he wrote the var-dumper search UI. Perhaps he has a plan... First thought was;
Yep. This needs to be prepared, but first we need a plan :) |
I love @javiereguiluz examples:
No plan right now, I can give it a try...but that'll wait for 4.1 I think 😅 📝 might be useful: https://codepen.io/trevanhetzel/pen/rOVrGK |
I think it would be fine to do log level now, then channel filtering later. It may still be a challenge to get something quickly (and dependably) that looks nice. But, I'd love if you could make that happen @ro0NL :) |
Range inputs can be styled native actually. Shocking. Maybe combine to range inputs for lower/upper bound. I believe @javiereguiluz proposal implies that.. going to jsfiddle NOW :) |
Got something https://jsfiddle.net/z2ov274f/ Let me know if this works for you. I think it just might do 👍 |
@ro0NL I think you are over-delivering here 😄 I don't think we need a multi-range slider. A user wants to see "debug logs or higher", "info logs or higher", "warning logs or higher", etc. A step-by-step slider like this one would be enough: |
Yes indeed, simple is better :) |
The problem is we always include debug then; thus the noise. |
@ro0NL make "info" the initial value of the slider. Problem solved! |
@ro0NL DYT my idea of filter logs by channel can be acheived in this same PR? I am really sure it is a good feature for a developer The use case is simple, when we reach this section of profiler's log, we come here for a very specific reason, so the more specific the data is visualy, the best it is :) |
@javiereguiluz you're right. Increasing the slider, means indeed "info/warning/etc. or higher". I had this mindset where it increases from the first level (debug till warning, debug till error, etc.). The right boundary is fixed, not the left one :) Anyway made the multiple range thingy a gist, can probably use it sometime :-) Ill try to finish this one this weekend. @noniagriconomie ill check channels as well, to see if something simple is possible. |
Latest version after some discussion with @javiereguiluz https://jsfiddle.net/m2xq73ba/ Almost there. edit: i also just realized for this UX to be right we need to go from critical to debug, so left-to-right. |
It's kinda working :) Screenshot updated.
|
Indeed, I'd be in favor of removing the
Perhaps that's where the slider was more obvious. But clearly, I'd not put both. |
What about pills with a checkbox? (like a filter). |
IMO multi select input would be better (and take less space in the view) |
About the checkbox/filter issues... im not sure =/ i tend to agree with @javiereguiluz
It's about increasing/decreasing severity, not necessarily "filter by field".
Im not aiming for channel filters anymore with this PR, so should not be a blocker, nor do they have to be the same widget style in the future. |
Moving to 4.1. Rebase on master might be needed, where PHP 7.1 features can be used btw. |
Just for the record: #23247 is about filtering logs completely so they aren't even written to the profiler (for performance reasons) while this PR is about filtering logs when viewing them in the profiler. 👍 for this feature, would be a nice addition! |
I'm willing to finish this, and quite happy with my work so far actually :) But there are many ways we can solve this UX-wise, and perhaps we should aim for a simpler approach. Im curious if e.g. @javiereguiluz @ogizanagi ... has some time to help me move forward, or willing to takeover from here on. |
Can we resume the work here. It seems that we are almost there. Having this in 4.2 would be great. @javiereguiluz ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last call for reviews before merge :)
For merge on master of course |
UI tweaks can happen during the stabilization phase. |
Thank you @ro0NL. |
This PR was submitted for the 3.4 branch but it was merged into the 4.2-dev branch instead (closes #24263). Discussion ---------- Filter logs by level | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> Proposal to filter logs by level. This PR competes with #23247 (but also see #23038) which propose to filter by channel. <details> <summary>Before</summary>  </details> <details> <summary>After</summary>  </details> From #23247 (comment) > Adding configuration is always adding complexity for the end user. If we can do otherwise (including doing nothing), i think that might be better. I all depends on the current "brokenness" status. This avoids that. Also single click; noise gone. Commits ------- 8f88753 Filter logs by level
Proposal to filter logs by level. This PR competes with #23247 (but also see #23038) which propose to filter by channel.
Before
After
From #23247 (comment)
This avoids that. Also single click; noise gone.