Plugin Directory

Changeset 2224771


Ignore:
Timestamp:
01/09/2020 11:50:59 AM (6 years ago)
Author:
jayhybrid
Message:

Updated RegEx for better Log extraction

Location:
debug-log-list/tags/0.1.1.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • debug-log-list/tags/0.1.1.1/hybridsupply-log.php

    r2224769 r2224771  
    33 * Plugin Name: Debug Log List
    44 * Description: Extracts errors from your debug.log and groups them into individual items.
    5  * Version: 0.1.1.1
     5 * Version: 0.1.0.1
    66 * Author: Jay
    77 * Author URI: https://profiles.wordpress.org/jayhybrid
     
    1010 */
    1111defined('HYBRIDSUPPLY_LOG_FILE') or define('HYBRIDSUPPLY_LOG_FILE', __FILE__);
     12defined('HYBRIDSUPPLY_LOG_REGEX_EXTRACT') or define('HYBRIDSUPPLY_LOG_REGEX_EXTRACT', '/\[(\d{1,2}-\w{3}-\d{4} \d{2}:\d{2}:\d{2}).*\]\w*\w*\s*([ \w]*):?\s*(.+)/');
    1213
    1314function hybridsupply_log_options_html() {
     
    2829      $logfile_contents = file_get_contents( $logfile );
    2930
    30       preg_match_all('/\[(\d{1,2}-\w{3}-\d{4} \d{2}:\d{2}:\d{2}).*\]\w*\w*\s*([ \w]*):?\s*(.+)/' , $logfile_contents, $output, PREG_SET_ORDER);
     31      preg_match_all(HYBRIDSUPPLY_LOG_REGEX_EXTRACT , $logfile_contents, $output, PREG_SET_ORDER);
    3132
    3233      for ($i=0; $i < count($output); $i++) {
     
    5354
    5455            case 3:
    55               $hash = hash( 'sha256', $part );
     56              $hash = hash( 'crc32', $part );
    5657
    5758              if ( ! in_array($hash, $log_hashes) ) {
     
    5960              }
    6061
    61               /* preg_match('/(\/[\/\w\W]+php)/', $part, $match); */
    62               /* $log[$i]->folder = $match[0];             */
    6362              $log[$i]->folder ='';
    6463              $log[$i]->message = $part;
     
    224223
    225224        for ($i=0; $i < count($units1024); $i++) {
    226           $current_size1024 = round($filesize / pow(1024, $i + 1), 0);
    227           $current_size1000 = round($filesize / pow(1000, $i + 1), 0);
     225          $current_size1024 = round($filesize / pow(1024, $i + 1), 2);
     226          $current_size1000 = round($filesize / pow(1000, $i + 1), 2);
    228227
    229228          $byte = $current_size1024 == 1 ? 'byte' : 'bytes';
     
    348347    $logfile_contents = file_get_contents( $logfile );
    349348
    350     preg_match_all('/\[(\d{1,2}-\w{3}-\d{4} \d{2}:\d{2}:\d{2}).*\] ([\w \(\)]*):?\s*(.+)/' , $logfile_contents, $output, PREG_SET_ORDER);
     349    preg_match_all(HYBRIDSUPPLY_LOG_REGEX_EXTRACT , $logfile_contents, $output, PREG_SET_ORDER);
    351350
    352351    for ($i=0; $i < count($output); $i++) {
     
    360359
    361360          case 3:
    362             $hash = hash( 'sha256', $part );
    363 
    364             if ( !in_array($hash, $log_hashes) ) {
     361            $hash = hash( 'crc32', $part );
     362
     363            if ( ! in_array($hash, $log_hashes) ) {
    365364              $log_hashes[] = $hash;
    366365            }
  • debug-log-list/tags/0.1.1.1/readme.txt

    r2224767 r2224771  
    3232== Changelog ==
    3333
     34= 0.1.1.1 =
     35
     36* Updated RegEx for better Log extraction
     37
     38= 0.1.0.1 =
     39
     40* Bugfixes
     41
    3442= 0.1.0.0 =
    3543
Note: See TracChangeset for help on using the changeset viewer.