[GH-ISSUE #736] DateTime related changes in 2.0 #277

Closed
opened 2026-03-04 02:13:43 +03:00 by kerem · 2 comments
Owner

Originally created by @Seldaek on GitHub (Mar 3, 2016).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/736

Things to consider:

  • Switch to DateTimeImmutable?
  • Extend to make datetimes json serializable (#402) and make sure the format is configurable somehow?
  • Disable microsecond precision by default for performance?
Originally created by @Seldaek on GitHub (Mar 3, 2016). Original GitHub issue: https://github.com/Seldaek/monolog/issues/736 Things to consider: - Switch to DateTimeImmutable? - Extend to make datetimes json serializable (#402) and make sure the format is configurable somehow? - Disable microsecond precision by default for performance?
kerem closed this issue 2026-03-04 02:13:43 +03:00
Author
Owner

@stof commented on GitHub (Mar 3, 2016):

Switch to DateTimeImmutable

👍 for that

Disable microsecond precision by default for performance?

This looks like a good idea. People caring about the microsecond precision of their log can enable the feature.
The NormalizerFormatter (and so its child LineFormatter too) drops the microseconds by default when formatting the date anyway due to the default date format. So the performance is degraded for nothing.

Extend to make datetimes json serializable and make sure the format is configurable somehow?

if the format needs to be configurable, it will be hard to do it using JsonSerializable, as the DateTimeImmutable won't know the configuration of each formatter (and formatters may have different configs)

<!-- gh-comment-id:191697134 --> @stof commented on GitHub (Mar 3, 2016): > Switch to DateTimeImmutable :+1: for that > Disable microsecond precision by default for performance? This looks like a good idea. People caring about the microsecond precision of their log can enable the feature. The NormalizerFormatter (and so its child LineFormatter too) drops the microseconds by default when formatting the date anyway due to the default date format. So the performance is degraded for nothing. > Extend to make datetimes json serializable and make sure the format is configurable somehow? if the format needs to be configurable, it will be hard to do it using JsonSerializable, as the DateTimeImmutable won't know the configuration of each formatter (and formatters may have different configs)
Author
Owner

@Seldaek commented on GitHub (May 20, 2016):

Please check out https://github.com/Seldaek/monolog/pull/793 /cc @holtkamp too

<!-- gh-comment-id:220711905 --> @Seldaek commented on GitHub (May 20, 2016): Please check out https://github.com/Seldaek/monolog/pull/793 /cc @holtkamp too
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#277
No description provided.