Complete Refactor - Filter on log message - Possible new version 4.x

Created on 28 April 2021, about 3 years ago
Updated 20 March 2024, 3 months ago

Problem/Motivation

It would be nice if the module could filter based on message also, to filter out annoying messages.
Based on watchdog type (context channel), and log message starting with given string.

Steps to reproduce

Proposed resolution

We refactored the module to follow the coding and Drupal standards .

If this issue is merged, we recommend releasing a new version. 4.x

✨ Feature request
Status

Fixed

Version

3.2

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary Pasqualle πŸ‡­πŸ‡Ί Budapest

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί

    Message filtered based on issue ✨ Get log values (type and level) for syslog like the input box for dblog Needs review

  • Status changed to Needs review 4 months ago
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί

    Added PHPUnit test coverage.

  • πŸ‡ͺπŸ‡ΈSpain tunic Madrid

    I've added some comments to the MR. In general, the patch looks good to me.

  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί

    Set the GitlabCI file

  • Pipeline finished with Success
    4 months ago
    Total: 139s
    #105795
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί
  • Pipeline finished with Success
    4 months ago
    Total: 205s
    #105800
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί

    If this issue is merged, we recommend releasing a new version. 4.x

  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί
  • Pipeline finished with Success
    4 months ago
    Total: 139s
    #105869
  • Pipeline finished with Success
    4 months ago
    Total: 141s
    #105915
  • Pipeline finished with Success
    4 months ago
    Total: 206s
    #105921
  • Pipeline finished with Success
    4 months ago
    Total: 143s
    #105950
  • πŸ‡¨πŸ‡¦Canada harika gujjula

    harika gujjula β†’ made their first commit to this issue’s fork.

  • Status changed to Needs work 4 months ago
  • πŸ‡¨πŸ‡¦Canada harika gujjula

    @Pasqualle, @EduardoMoralesAlberti, @tunic Thank you for all your thoughts and work on Refactoring this module. The patch seems to be good as per the pointers mentioned. But, Looks like there are few issues noticed with the merge request.

    1. The form values does not appear to be saved for Db log Severity levels and syslog severity levels. This is because the type in Schema file is defined as boolean where it is expecting a string. Also accordingly update Schema and install files if necessary.
    2. Minor Warnings noticed on Trait when log values are empty.
    3. It would be good to include few readability changes alongside.
      • Update description text for "Enter DB Log type and Severity Levels" for both DBlog and Syslog to "Enter Log type and Severity Levels" on the Form.
      • Update help text for "Enter one value per line, in the format log_type|level1,level2,level3..|message to restrict the log messages stored, the message and the level are optionals." to "Enter one value per line, in the format log_type|level1,level2,level3..|message to limit the log messages stored, the message and the level are optionals."
  • Status changed to Needs review 4 months ago
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί

    @harika gujjula

    1. The form values does not appear to be saved for Db log Severity levels and syslog severity levels. This is because the type in Schema file is defined as boolean where it is expecting a string. Also accordingly update Schema and install files if necessary.

    Did you execute the module update?
    There is an update for this point, it takes the actual config on string format and transform it to booleans.
    If you have any problem with the update, please let me know.
    https://git.drupalcode.org/project/dblog_filter/-/merge_requests/9/diffs...

        switch ($key) {
          case 'severity_levels':
          case 'syslog_severity_levels':
            $severity_levels = [
              'critical' => FALSE,
              'notice' => FALSE,
              'emergency' => FALSE,
              'alert' => FALSE,
              'error' => FALSE,
              'warning' => FALSE,
              'info' => FALSE,
              'debug' => FALSE,
            ];
            $levels = (isset($config_raw_data[$key]) && is_array($config_raw_data[$key])) ? $config_raw_data[$key] : [];
            foreach ($levels as $level => $value) {
              if ($value && isset($severity_levels[$level])) {
                $severity_levels[$level] = TRUE;
              }
            }
            $config->set($key, $severity_levels);
            break;
    
    2. Minor Warnings noticed on Trait when log values are empty.

    It is also possible that is related with the update, could you give us more information of the warnings? We could not reproduce it.

    It would be good to include few readability changes alongside.
    Update description text for "Enter DB Log type and Severity Levels" for both DBlog and Syslog to "Enter Log type and Severity Levels" on the Form.
    Update help text for "Enter one value per line, in the format log_type|level1,level2,level3..|message to restrict the log messages stored, the message and the level are optionals." to "Enter one value per line, in the format log_type|level1,level2,level3..|message to limit the log messages stored, the message and the level are optionals."

    The text was updated on commit https://git.drupalcode.org/project/dblog_filter/-/merge_requests/9/diffs...

  • Pipeline finished with Success
    4 months ago
    Total: 142s
    #116395
  • Status changed to Needs work 4 months ago
  • πŸ‡¨πŸ‡¦Canada harika gujjula

    @EduardoMoralesAlberti, Thanks for the work again.

    Did you execute the module update? There is an update for this point, it takes the actual config on string format and transform it to booleans.

    You were right. I missed to execute the update hook. Thanks. Now I see the config is saved, but the default values are not still populated on the form? And this is noticed with both dblog severity levels, syslog severity levels. Might have to just update #default_value as per the transformation from string to boolean ?

      $form['dblog']['severity_levels'] = [
          '#type' => 'checkboxes',
          '#title' => $this->t('Select Severity Levels'),
          '#description' => $severity_description,
          '#options' => $severity_levels,
          '#default_value' => $config->get('severity_levels') ?? [],
        ];
    
    Minor Warnings noticed on Trait when log values are empty.
    It is also possible that is related with the update, could you give us more information of the warnings? We could not reproduce it.

    You were right again. This is due to the missing update hook. So, the cause for the warning earlier was due to the log_values config was of type string and foreach in LogTrait is throwing warnings. The log values is an array now after the update. This is now good.

    Thank you for the description text updates too.

  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί

    @harika gujjula We refactor the default value code to check the config saved, sorry we missed it, thank you.
    Could you test it again and confirm?

    Commit https://git.drupalcode.org/project/dblog_filter/-/merge_requests/9/diffs...

  • Pipeline finished with Success
    4 months ago
    Total: 141s
    #118033
  • Status changed to Needs review 4 months ago
  • πŸ‡ͺπŸ‡ΈSpain Eduardo Morales Alberti Spain, πŸ‡ͺπŸ‡Ί
  • Status changed to RTBC 3 months ago
  • πŸ‡¨πŸ‡¦Canada harika gujjula

    Perfect! Looks good now. Thanks for all your work.

  • Pipeline finished with Skipped
    3 months ago
    #124530
  • πŸ‡¨πŸ‡¦Canada harika gujjula

    Released a new version 4.0 with all the changes captured.
    Also added support for Drupal 11.

    Thanks all for all your time.

  • Status changed to Fixed 3 months ago
Production build 0.69.0 2024