monolog
monolog copied to clipboard
Allow to specify time for log records
That would be nice to allow users mock time for log records.
\Monolog\Logger::addRecord has an optional parameter for log timestamp. However, methods that implement Psr\Log\LoggerInterface do not have such a parameter.
I think the best way to fix this is passing optional $clock parameter to the logger constructor that implements PSR 20 interface.
Then addRecord could fetch timestamp from the clock service
Sounds reasonable to me if you want to send a PR :)