Skip to content

Allow to specify time for log records #1902

Open
@Chi-teck

Description

@Chi-teck

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions