8000 minor #58788 [Mailer] use microsecond precision SMTP logging (0xb4lint) · symfony/symfony@d8f8080 · GitHub
[go: up one dir, main page]

Skip to content

Commit d8f8080

Browse files
committed
minor #58788 [Mailer] use microsecond precision SMTP logging (0xb4lint)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [Mailer] use microsecond precision SMTP logging | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Replaced `date('c')` with `(new \DateTimeImmutable())->format('Y-m-d\TH:i:s.up')` to have microsecond precision. Before: `2024-11-06T12:57:35+00:00` (ISO 8601) After: `2024-11-06T12:57:35.123456Z` (ISO 8601 with microseconds) This change makes possible to inspect each SMTP command's time consumption. Commits ------- 6d8c53e [Mailer] use microsecond precision SMTP logging
2 parents 19f89d6 + 6d8c53e commit d8f8080

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ abstract class AbstractStream
3737
public function write(string $bytes, bool $debug = true): void
3838
{
3939
if ($debug) {
40-
$timestamp = date('c');
40+
$timestamp = (new \DateTimeImmutable())->format('Y-m-d\TH:i:s.up');
4141
foreach (explode("\n", trim($bytes)) as $line) {
4242
$this->debug .= \sprintf("[%s] > %s\n", $timestamp, $line);
4343
}
@@ -93,7 +93,7 @@ public function readLine(): string
9393
}
9494
}
9595

96-
$this->debug .= \sprintf('[%s] < %s', date('c'), $line);
96+
$this->debug .= \sprintf('[%s] < %s', (new \DateTimeImmutable())->format('Y-m-d\TH:i:s.up'), $line);
9797

9898
return $line;
9999
}

0 commit comments

Comments
 (0)
0