adixon / ca.civicrm.logviewer

CiviCRM Log Viewer
Other
9 stars 11 forks source link

Add filters #22

Open allinappliadmin opened 4 months ago

allinappliadmin commented 4 months ago

Would it be possible to add filter like in the web browser console to choose between error warning ìnfo`debug...? This would help solving issues

image

adixon commented 4 months ago

That sounds like a good idea. I'm curious whether the log file is now well-formed enough that we can do that reliably, but it certainly looks like it from a few samples. Did you want to put together some code, or were you hoping someone else was going to add the feature?

allinappliadmin commented 4 months ago

I was more hoping that someone handles that. how long would that take to get it done?

adixon commented 4 months ago

Well, this is (unfunded) open source, so the only reliable answer is "it depends".

The good news is that it sounds like a fairly straightforward improvement and that others might benefit and appreciate it.

allinappliadmin commented 4 months ago

this is already a good news

gngn23 commented 1 month ago

The last commit enables filtering: LogViewerFilter

This is done by changing the Page to Form (i.e. CRM/Logviewer/Page/LogViewer.php -> CRM/Logviewer/Form/LogViewer.php).

I split up the former run() function into buildQuickForm() and postProcess(). To filter by log level I parse the message ('[error]', '[debug'], ...), split the log level and add a new column .

Also:

Todo: I did not managed to show a reset button:

  $this->addButtons([
      [
        'type' => 'submit',
        'name' => E::ts('Filter'),
        'isDefault' => TRUE,
      ],
      ['type' => 'reset', 'name' => E::ts('Reset')],
    ]);

only shows the button 'Filter' but 'Reset' is not visible in the UI. Any ideas hot to add a reset button?