mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-25 23:55:56 +03:00
[GH-ISSUE #1902] Allow to specify time for log records #819
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#819
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Chi-teck on GitHub (Jul 31, 2024).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1902
That would be nice to allow users mock time for log records.
\Monolog\Logger::addRecordhas an optional parameter for log timestamp. However, methods that implementPsr\Log\LoggerInterfacedo not have such a parameter.I think the best way to fix this is passing optional
$clockparameter to the logger constructor that implements PSR 20 interface.Then
addRecordcould fetch timestamp from the clock service@Seldaek commented on GitHub (Nov 9, 2024):
Sounds reasonable to me if you want to send a PR :)