| 56 | return thread |
| 57 | |
| 58 | def format(self, record: LogRecord): |
| 59 | # In case we have multiple formatters, we have to keep a copy of the record. |
| 60 | record = copy.copy(record) |
| 61 | |
| 62 | # early logging may access ql.os when it is not yet set |
| 63 | try: |
| 64 | cur_thread = self.ql.os.thread_management.cur_thread |
| 65 | except AttributeError: |
| 66 | tid = '' |
| 67 | else: |
| 68 | tid = self.get_thread_tag(str(cur_thread)) |
| 69 | |
| 70 | level = self.get_level_tag(record.levelname) |
| 71 | record.levelname = f'{level} {tid}' |
| 72 | |
| 73 | return super().format(record) |
| 74 | |
| 75 | |
| 76 | class QlColoredFormatter(QlBaseFormatter): |