You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LogRecord makes microseconds available via the msecs attribute. This patch adds microseconds via usecs attribute.
Some regulators (eg MIFID II) require accuracy greater than 1ms in some industries.
This patch calls time_ns rather than time so that the usecs and msecs are calculated from int types and then gets the original ct attribute via division.
Thanks for the patch. We're need to get contributors to sign a Contributor License Agreement (CLA) before we can accept their patches. Would you be willing to do this? The process could be smoother, but it's not too bad, and here's where you get started:
Any progress here? That would be really helpful feature. Had to implement third-party Formatter class to solve this issue.
Maybe, core team could implement something similar? Or maybe even allow "%f" in the dateFormat?
import logging
from datetime import datetime
class CustomFormatter(logging.Formatter):
def formatTime(self, record, datefmt=None):
if not datefmt:
return super().formatTime(record, datefmt=datefmt)
return datetime.fromtimestamp(record.created).astimezone().strftime(datefmt)
Activity
jamescasbon commentedon Jan 7, 2022
LogRecord makes microseconds available via the msecs attribute. This patch adds microseconds via usecs attribute.
Some regulators (eg MIFID II) require accuracy greater than 1ms in some industries.
This patch calls time_ns rather than time so that the usecs and msecs are calculated from int types and then gets the original ct attribute via division.
vsajip commentedon Jan 7, 2022
Thanks for the patch. We're need to get contributors to sign a Contributor License Agreement (CLA) before we can accept their patches. Would you be willing to do this? The process could be smoother, but it's not too bad, and here's where you get started:
https://www.python.org/psf/contrib/contrib-form/
askoretskiy commentedon Jul 5, 2024
Any progress here? That would be really helpful feature. Had to implement third-party
Formatterclass to solve this issue.Maybe, core team could implement something similar? Or maybe even allow "%f" in the dateFormat?
vsajip commentedon Jul 5, 2024
Patch partly superseded by #102412 and #120709. Will look into this shortly.
askoretskiy commentedon Feb 2, 2025
Thanks for merging into Python 3.13.
How fix is shorter:
And usage:
sayedmasihemami commentedon Sep 14, 2026
@askoretskiy should the multiplier in your suggested fix not be 1_000_000 instead?