• Resolved azzuwayed

    (@azzuwayed)


    Hello,

    I’m really enjoying your plugin, but I’ve encountered a small issue. Many plugins use prefixes like [DEBUG], [INFO], [WARNING], and [ERROR] when debugging is activated. However, these specific messages are being replaced by “No error message specified…”, which requires me to manually access the file to view them. I believe this problem stems from the way timestamps are processed, as the plugin isn’t anticipating a second set of square brackets.

    To address this, I’ve added a line in the file /debug-log-manager/classes/class-debug-log.php within the get_processed_entries() function:

    // Read the errors log file 
    $log 	= file_get_contents($debug_log_file_path);
    
    // NEW: Ignore words between square brackets
    $log = preg_replace("/\[([a-zA-Z]+)\]/", "$1", $log);

    I hope this suggestion proves helpful for future updates.

    Best regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Bowo

    (@qriouslad)

    Thanks for reporting the issue and suggesting the nifty preg_replace fix. Will test and implement in the next release.

    Thread Starter azzuwayed

    (@azzuwayed)

    Thanks @qriouslad

    Today I found an error from Cloudflare plugin which didn’t show up too because [some- words] contained spaces and dashes.

    [22-Oct-2023 22:47:02 UTC] [Cloudflare] ERROR: [CLIENT API] Array
    (
        [type] => request
        [path] => https://api.cloudflare.com/client/v4/zones/xxx/pagerules?status=active
        [timeout] => 30
        [method] => GET
        [headers] => Array
            (
                [Content-Type] => application/json
                [User-Agent] => wordpress/6.3.2; cloudflare-wordpress-plugin/4.12.2
                [Authorization] => REDACTED
            )
    
    )

    I have updated the regular expression accordingly to address this:

    $log = preg_replace("/\[([a-zA-Z\s\-]+)\]/", "$1", $log);
    

    The result:

    Cloudflare ERROR: CLIENT API Array ( type => request path => https://api.cloudflare.com/client/v4/zones/xxx/pagerules?status=active timeout => 30 method => GET headers => Array ( Content-Type => application/json User-Agent => wordpress/6.3.2; cloudflare-wordpress-plugin/4.12.2 Authorization => REDACTED ) )
    Plugin Author Bowo

    (@qriouslad)

    @azzuwayed sorry this took me a while, but your preg_replace regex has been implemented in v2.3.0 just released. Thank you!!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Ignore Words with [Square Brackets]’ is closed to new replies.