Skip to content

[Monolog Bridge] ChromeHeadless ChromePHPLogger support #22264

@redthor

Description

@redthor
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2

I have logged Seldaek/monolog#966 about getting Chromium 57 user agent string support. Unfortunately the regex is overridden by the bridge in the child class.

I can change the Symfony Monolog Bridge like so:

index 2636bc3..1f99552 100644
--- a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
+++ b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
@@ -41,7 +41,7 @@ class ChromePhpHandler extends BaseChromePhpHandler
             return;
         }
 
-        if (!preg_match('{\b(?:Chrome/\d+(?:\.\d+)*|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}', $event->getRequest()->headers->get('User-Agent'))) {
+        if (!preg_match(self::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
             $this->sendHeaders = false;
             $this->headers = array();

However to get this patch to work I'd also need to bump the monolog minimum version from ~1.11 to ~1.19.0 (April 2016) to get the self::USER_AGENT_REGEX const in the parent class.

Otherwise I have to repeat that same change here as Seldaek/monolog#966

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions