AOSSIE-Org / AOSSIE-Org/PictoPy

BUG: Inconsistent Logger Usage Across Backend Modules

未关闭
#1,515 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug enhancement possible-duplicate
主要语言
Python
星标
283
派生
679
平均合并
7 天 2 小时
30 天内合并 PR
3

描述

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

Three modules use Python's stdlib logging.getLogger directly instead of the project's own get_logger from app.logging.setup_logging. This means their log output bypasses the ColorFormatter, component-level prefixes, and environment-level filtering configured in setup_logging.py.

### Affected files

| File | Problem |
|------|---------|
| `backend/app/utils/images.py` | `get_logger` assigned correctly on line 35, then **silently overwritten** by `logging.getLogger` on line 41 |
| `backend/app/routes/face_clusters.py` | Uses `logging.getLogger` directly; all 7 sibling route files use `get_logger` |
| `backend/app/routes/models.py` | Uses `logging.getLogger` directly; all 7 sibling route files use `get_logger` |

### Root Cause

`images.py` has a duplicate logger definition the second one overwrites the
first:

```python
# Line 35 — correct
logger = get_logger(__name__)

# Line 41 — overwrites the above, bypassing all custom setup
logger = logging.getLogger(__name__)
```

`face_clusters.py` and `models.py` simply never adopted the project logger
pattern that every other route module follows.

### Record

- [x] I agree to follow this project's Code of Conduct

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。