(limit: int = 8)
| 601 | |
| 602 | |
| 603 | def tail_error_lines(limit: int = 8) -> list[str]: |
| 604 | combined = [] |
| 605 | for label, path in (("后端", APP_STDERR_LOG), ("nginx", NGINX_ERROR_LOG)): |
| 606 | lines = tail_lines(path, max_lines=40) |
| 607 | interesting = [line for line in lines if re.search(r"error|warn|fail|502|trace|deprecat", line, re.I)] |
| 608 | if interesting: |
| 609 | combined.extend([f"[{label}] {line}" for line in interesting[-4:]]) |
| 610 | return combined[-limit:] |
| 611 | |
| 612 | |
| 613 | def open_auth_db() -> sqlite3.Connection: |
no test coverage detected