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

Allow to specify time for log records #1902

Open
Chi-teck opened this issue Jul 31, 2024 · 1 comment
Open

Allow to specify time for log records #1902

Chi-teck opened this issue Jul 31, 2024 · 1 comment
Labels

Comments

@Chi-teck
Copy link

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

@Seldaek
Copy link
Owner

Seldaek commented Nov 9, 2024

Sounds reasonable to me if you want to send a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants