fix(travel-proxy): logging.basicConfig 추가 + 동기화 진행 로그 강화

- main.py에 basicConfig(level=INFO) 추가 — 기존엔 기본 WARNING이라 info 로그 무시됨
- indexer: 앨범별 변경사항 로그, 썸네일 100개 단위 진행률 로그

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 12:24:19 +09:00
parent 496646fb32
commit 00a610c374
2 changed files with 22 additions and 2 deletions

View File

@@ -179,8 +179,11 @@ def sync(
added = 0 added = 0
updated = 0 updated = 0
removed = 0 removed = 0
sorted_albums = sorted(all_albums)
total_albums = len(sorted_albums)
for album in sorted(all_albums): logger.info("Syncing %d albums...", total_albums)
for i, album in enumerate(sorted_albums, 1):
folder = travel_root / album folder = travel_root / album
items = _scan_folder(folder) items = _scan_folder(folder)
existing_filenames = {item["filename"] for item in items} existing_filenames = {item["filename"] for item in items}
@@ -190,17 +193,30 @@ def sync(
updated += result["updated"] updated += result["updated"]
removed += result["removed"] removed += result["removed"]
if result["added"] or result["removed"]:
logger.info(
"[%d/%d] %s: +%d/-%d (%d files)",
i, total_albums, album, result["added"], result["removed"], len(items),
)
logger.info("DB sync done: added=%d updated=%d removed=%d", added, updated, removed)
# 3. 썸네일 미생성 분 일괄 생성 # 3. 썸네일 미생성 분 일괄 생성
no_thumb = db.get_photos_without_thumb() no_thumb = db.get_photos_without_thumb()
thumbs_generated = 0 thumbs_generated = 0
thumb_done_batch = [] thumb_done_batch = []
for photo in no_thumb: if no_thumb:
logger.info("Generating %d thumbnails...", len(no_thumb))
for idx, photo in enumerate(no_thumb, 1):
src = travel_root / photo["album"] / photo["filename"] src = travel_root / photo["album"] / photo["filename"]
dest = thumb_root / photo["album"] / photo["filename"] dest = thumb_root / photo["album"] / photo["filename"]
if _generate_thumb(src, dest): if _generate_thumb(src, dest):
thumb_done_batch.append(photo) thumb_done_batch.append(photo)
thumbs_generated += 1 thumbs_generated += 1
if idx % 100 == 0:
logger.info("Thumbnails: %d/%d done", idx, len(no_thumb))
db.batch_mark_thumbs_done(thumb_done_batch) db.batch_mark_thumbs_done(thumb_done_batch)

View File

@@ -12,6 +12,10 @@ from PIL import Image
from .db import init_db, get_photos_by_region, get_all_albums, set_album_cover, mark_thumb_done from .db import init_db, get_photos_by_region, get_all_albums, set_album_cover, mark_thumb_done
from .indexer import sync, _load_region_map_merged from .indexer import sync, _load_region_map_merged
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
app = FastAPI() app = FastAPI()