先转字符串,再做日志脱敏,适合打印 dict / list / 任意对象。
(obj)
| 38 | |
| 39 | |
| 40 | def safe_repr(obj) -> str: |
| 41 | """ |
| 42 | 先转字符串,再做日志脱敏,适合打印 dict / list / 任意对象。 |
| 43 | """ |
| 44 | try: |
| 45 | return sanitize_log_message(repr(obj)) |
| 46 | except Exception: |
| 47 | return sanitize_log_message(str(obj)) |
| 48 | |
| 49 | |
| 50 | class DistributedWorkerServer: |
no test coverage detected