Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edebug() should probably also get ride of "\r\n" when using LoggerInterface #3045

Closed
axi opened this issue Apr 5, 2024 · 1 comment
Closed

Comments

@axi
Copy link

axi commented Apr 5, 2024

Problem description

Using LoggerInterface, I don't see why we should have the SMTP::LE chars passed to the debug method

    protected function edebug($str)
    {
       ...
       if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) {
            $this->Debugoutput->debug($str);

            return;
        }

In my case, with Monolog\Formatter\LineFormatter and a $allowInlineLineBreaks = true, I was seeing logs with an empty line between each log line

[2024-03-14T15:44:05.083183+00:00] logger.DEBUG: CLIENT -> SERVER: 
  
[2024-03-14T15:44:05.083250+00:00] logger.DEBUG: CLIENT -> SERVER: .
  
[2024-03-14T15:44:05.247371+00:00] logger.DEBUG: CLIENT -> SERVER: QUIT

Setting $allowInlineLineBreaks to false solved it but I don't thing this is usefull.

Using same preg_replace as 'html' and 'echo' cases would give this:

       if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) {
            $this->Debugoutput->debug(preg_replace('/[\r\n]+/', '', $str));

            return;
        }

Should I propose a PR for that ?

@Synchro
Copy link
Member

Synchro commented Apr 6, 2024

Yes, that seems reasonable, go ahead with a PR.

Synchro added a commit that referenced this issue Apr 8, 2024
Remove potential ending line break when using edebug() with LoggerInterface
@axi axi closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants