Formats the log record's creation time into MM:SS.cs format. Uses `time.localtime` to convert the record's creation timestamp and formats it as minutes, seconds, and centiseconds. The `datefmt` argument provided by the base class is ignored in this custom implementa
(self, record: logging.LogRecord, datefmt: Optional[str] = None)
| 14 | """ |
| 15 | |
| 16 | def formatTime(self, record: logging.LogRecord, datefmt: Optional[str] = None) -> str: |
| 17 | """ |
| 18 | Formats the log record's creation time into MM:SS.cs format. |
| 19 | |
| 20 | Uses `time.localtime` to convert the record's creation timestamp and |
| 21 | formats it as minutes, seconds, and centiseconds. The `datefmt` argument |
| 22 | provided by the base class is ignored in this custom implementation. |
| 23 | |
| 24 | Args: |
| 25 | record: The log record whose creation time needs formatting. |
| 26 | datefmt: An optional date format string (ignored by this method). |
| 27 | |
| 28 | Returns: |
| 29 | A string representing the formatted time (e.g., "59:23.18"). |
| 30 | """ |
| 31 | # Use localtime as originally intended, but locally within this formatter |
| 32 | now = time.localtime(record.created) |
| 33 | cs = int((record.created % 1) * 100) # centiseconds |
| 34 | # Format the time string as required |
| 35 | s = time.strftime("%M:%S", now) + f".{cs:02d}" |
| 36 | return s |
| 37 | |
| 38 | def setup_logging(level: int = logging.INFO) -> None: |
| 39 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected