Skip to content

Commit 56fb551

Browse files
committed
logging: Add ticks property.
`ticks` is the value of `time.ticks_ms()` when the log record is setup. For systems without a millisecond-accurate RTC, such as the RP2, this helps bring time-granularity to log entries. Signed-off-by: Jared Hancock <[email protected]>
1 parent 27e4d73 commit 56fb551

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

python-stdlib/logging/logging.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def set(self, name, level, message):
3636
self.ct = time.time()
3737
self.msecs = int((self.ct - int(self.ct)) * 1000)
3838
self.asctime = None
39+
self.ticks = time.ticks_ms()
3940

4041

4142
class Handler:
@@ -102,6 +103,7 @@ def format(self, record):
102103
"msecs": record.msecs,
103104
"asctime": record.asctime,
104105
"levelname": record.levelname,
106+
"ticks": record.ticks,
105107
}
106108

107109

0 commit comments

Comments
 (0)