music-lab: Suno 디버깅 로그를 print()로 변경 (uvicorn 로그에 확실히 출력)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 12:50:46 +09:00
parent f7c583b806
commit 2d98c4176b

View File

@@ -103,7 +103,7 @@ def run_suno_generation(task_id: str, params: dict) -> None:
# ── 1단계: 곡 생성 요청 ──
payload = _build_suno_payload(params)
logger.info("Suno generate request: %s", payload)
print(f"[SUNO DEBUG] generate payload: {payload}")
resp = requests.post(
f"{SUNO_BASE_URL}/generate",
@@ -123,6 +123,7 @@ def run_suno_generation(task_id: str, params: dict) -> None:
error=f"Suno API 거부: {body.get('msg', 'unknown error')}")
return
print(f"[SUNO DEBUG] generate response: {body}")
suno_task_id = body.get("data", {}).get("taskId", "")
if not suno_task_id:
update_task(task_id, "failed", 0, "", error="Suno 응답에 taskId가 없습니다")
@@ -261,9 +262,9 @@ def _poll_until_complete(task_id: str, suno_task_id: str) -> Optional[list]:
elif status == "FIRST_SUCCESS":
update_task(task_id, "processing", max(progress, 60), "첫 번째 트랙 완료, 두 번째 생성 중...")
elif status == "SUCCESS":
# 완료 — 트랙 추출 (응답 구조 디버깅용 로깅)
logger.info("Suno SUCCESS response data keys: %s", list(data.keys()))
logger.info("Suno SUCCESS full data: %s", body)
# 완료 — 트랙 추출 (디버깅용 print)
import json as _json
print(f"[SUNO DEBUG] SUCCESS response body: {_json.dumps(body, ensure_ascii=False, default=str)[:2000]}")
tracks = data.get("sunoData") or data.get("data") or data.get("tracks") or []
# data 자체가 리스트일 수도 있음
if not tracks and isinstance(data, list):