Structured Logging (ARCH7158)
هذا المحتوى غير متوفر بلغتك بعد.
Key php.logging.structured-logging · Severity warning · Category logging
Embedding variables via interpolation/concatenation in a log message hurts log aggregation. Use a parameterized message template instead.
Incorrect
Section titled “Incorrect”<?php$this->logger->info('User ' . $user->getId() . ' logged in from ' . $ip);Correct
Section titled “Correct”<?php$this->logger->info('User {userId} logged in from {ip}', [ 'userId' => $user->getId(), 'ip' => $ip,]);Pass values through placeholders in a parameterized context array instead of embedding them in the message.