Skip to content

Commit 5cd071b

Browse files
committed
[refactor] 로그 주석 처리
1 parent 079a223 commit 5cd071b

30 files changed

Lines changed: 1453 additions & 107 deletions

File tree

moodico/moodtest/color_analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def product_result_by_mood(mood):
3333
return filtered_results
3434

3535
except Exception as e:
36-
logger.error(f"제품 필터링 중 에러 발생: {e}")
36+
# logger.error(f"제품 필터링 중 에러 발생: {e}")
3737
return []
3838

3939
# 무드필터링 된 제품을 받아서 랜덤으로 최대 3개 반환하는 함수

moodico/moodtest/views.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ def mood_result(request):
1616
if request.method == 'POST':
1717
mood = request.POST.get('mood', '캐주얼')
1818
if request.user.is_authenticated:
19-
try:
20-
user_profile, created = UserProfile.objects.get_or_create(user=request.user)
21-
user_profile.mood_result = mood
22-
user_profile.save()
23-
logger.info(f"사용자 {request.user.username}의 무드 테스트 결과 '{mood}'가 저장되었습니다.")
24-
except Exception as e:
25-
logger.error(f"무드 테스트 결과 저장 실패: {e}")
19+
# try:
20+
user_profile, created = UserProfile.objects.get_or_create(user=request.user)
21+
user_profile.mood_result = mood
22+
user_profile.save()
23+
# logger.info(f"사용자 {request.user.username}의 무드 테스트 결과 '{mood}'가 저장되었습니다.")
24+
# except Exception as e:
25+
# logger.error(f"무드 테스트 결과 저장 실패: {e}")
2626
else:
2727
mood = '캐주얼' # 기본값
2828

moodico/products/views.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def product_detail(request, product_id):
5858
def crawled_product_detail(request, crawled_id):
5959
"""크롤링된 제품 상세 페이지 뷰"""
6060
try:
61-
logger.info(f"크롤링된 제품 상세 페이지 요청: crawled_id = {crawled_id}")
61+
# logger.info(f"크롤링된 제품 상세 페이지 요청: crawled_id = {crawled_id}")
6262

6363
# products_clustered.json에서 제품 정보 찾기
6464
product_path = os.path.join(settings.BASE_DIR, 'static', 'data', 'all_products.json')
@@ -103,7 +103,7 @@ def crawled_product_detail(request, crawled_id):
103103
return render(request, 'products/crawled_detail.html', context)
104104

105105
except Exception as e:
106-
logger.error(f"크롤링된 제품 상세 정보 로드 실패: {e}")
106+
# logger.error(f"크롤링된 제품 상세 정보 로드 실패: {e}")
107107
return render(request, 'products/detail.html', {
108108
'error': '제품 정보를 불러오는 중 오류가 발생했습니다.',
109109
'product': None
@@ -211,7 +211,7 @@ def toggle_product_like(request):
211211
'message': '잘못된 JSON 형식입니다.'
212212
}, status=400)
213213
except Exception as e:
214-
logger.error(f"좋아요 토글 오류: {str(e)}")
214+
# logger.error(f"좋아요 토글 오류: {str(e)}")
215215
return JsonResponse({
216216
'success': False,
217217
'message': '서버 오류가 발생했습니다.'
@@ -244,7 +244,7 @@ def get_user_likes(request):
244244
})
245245

246246
except Exception as e:
247-
logger.error(f"좋아요 목록 조회 오류: {str(e)}")
247+
# logger.error(f"좋아요 목록 조회 오류: {str(e)}")
248248
return JsonResponse({
249249
'success': False,
250250
'message': '서버 오류가 발생했습니다.'
@@ -288,13 +288,13 @@ def get_liked_products_color_info(liked_products):
288288
with open(json_path, 'r', encoding='utf-8') as f:
289289
all_products = json.load(f)
290290
except FileNotFoundError:
291-
logger.error("products JSON 파일을 찾을 수 없습니다: %s", json_path)
291+
# logger.error("products JSON 파일을 찾을 수 없습니다: %s", json_path)
292292
return []
293293
# 제품명으로 매칭하여 색상 정보 추가
294294
products_with_colors = []
295295

296296
for liked_product in liked_products:
297-
logger.info(f"찜한 제품 처리 중: {liked_product.product_name} (브랜드: {liked_product.product_brand})")
297+
# logger.info(f"찜한 제품 처리 중: {liked_product.product_name} (브랜드: {liked_product.product_brand})")
298298
# all_products.json에서 매칭되는 제품 찾기
299299
matching_product = None
300300
for product in all_products:
@@ -316,7 +316,7 @@ def get_liked_products_color_info(liked_products):
316316
break
317317

318318
if matching_product:
319-
logger.info("제품 매칭 성공: %s -> URL: %s", matching_product.get('name'), matching_product.get('url'))
319+
# logger.info("제품 매칭 성공: %s -> URL: %s", matching_product.get('name'), matching_product.get('url'))
320320
products_with_colors.append({
321321
'id': liked_product.product_id, # 기존과 동일: Like의 product_id 유지
322322
'name': liked_product.product_name,
@@ -330,7 +330,7 @@ def get_liked_products_color_info(liked_products):
330330
'url': matching_product.get('url', '#')
331331
})
332332
else:
333-
logger.warning(f"제품 매칭 실패: {liked_product.product_name} (브랜드: {liked_product.product_brand})")
333+
# logger.warning(f"제품 매칭 실패: {liked_product.product_name} (브랜드: {liked_product.product_brand})")
334334
# 매칭되지 않는 경우 기본값 사용
335335
products_with_colors.append({
336336
'id': liked_product.product_id,
@@ -373,7 +373,7 @@ def get_product_like_count(request):
373373
})
374374

375375
except Exception as e:
376-
logger.error(f"제품 좋아요 수 조회 실패: {e}")
376+
# logger.error(f"제품 좋아요 수 조회 실패: {e}")
377377
return JsonResponse({'error': '좋아요 수를 가져오는 중 오류가 발생했습니다.'}, status=500)
378378

379379
# ------------------------------
@@ -473,7 +473,7 @@ def submit_product_rating(request):
473473
})
474474

475475
except Exception as e:
476-
logger.error(f"제품 별점 제출 실패: {e}")
476+
# logger.error(f"제품 별점 제출 실패: {e}")
477477
return JsonResponse({'error': '별점을 저장하는 중 오류가 발생했습니다.'}, status=500)
478478

479479
@require_http_methods(["GET"])
@@ -526,7 +526,7 @@ def get_product_rating(request):
526526
})
527527

528528
except Exception as e:
529-
logger.error(f"제품 별점 조회 실패: {e}")
529+
# logger.error(f"제품 별점 조회 실패: {e}")
530530
return JsonResponse({'error': '별점을 가져오는 중 오류가 발생했습니다.'}, status=500)
531531

532532
@require_http_methods(["GET"])
@@ -558,7 +558,7 @@ def get_product_ratings_list(request):
558558
})
559559

560560
except Exception as e:
561-
logger.error(f"제품 별점 목록 조회 실패: {e}")
561+
# logger.error(f"제품 별점 목록 조회 실패: {e}")
562562
return JsonResponse({'error': '별점 목록을 가져오는 중 오류가 발생했습니다.'}, status=500)
563563

564564
# 리뷰 이미지 삭제 부분
@@ -613,7 +613,7 @@ def get_multiple_products_like_info(request):
613613
})
614614

615615
except Exception as e:
616-
logger.error(f"여러 제품 찜 정보 조회 오류: {str(e)}")
616+
# logger.error(f"여러 제품 찜 정보 조회 오류: {str(e)}")
617617
return JsonResponse({
618618
'success': False,
619619
'message': '서버 오류가 발생했습니다.'
@@ -652,7 +652,7 @@ def product_ranking_api(request):
652652
})
653653

654654
except Exception as e:
655-
logger.error(f"제품 랭킹 조회 오류: {str(e)}")
655+
# logger.error(f"제품 랭킹 조회 오류: {str(e)}")
656656
return JsonResponse({
657657
'success': False,
658658
'message': '서버 오류가 발생했습니다.'
@@ -706,7 +706,7 @@ def product_ranking(request):
706706
'selected_category': category, # 선택된 카테고리 표시용
707707
})
708708
except Exception as e:
709-
logger.error(f"제품 랭킹 페이지 오류: {str(e)}")
709+
# logger.error(f"제품 랭킹 페이지 오류: {str(e)}")
710710
return render(request, 'products/product_ranking.html', {
711711
'top_products': [],
712712
'error_message': '랭킹 정보를 불러오는데 실패했습니다.'

moodico/recommendation/views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def recommend_by_color(request):
8585
return JsonResponse({"error": "Missing coordinates"}, status=400)
8686

8787
coord = np.array([warm, deep, lab_l, lab_a, lab_b])
88-
logger.info(f"Received coordinates: warmCool={warm}, lightDeep={deep}, lab_l={lab_l}, lab_a={lab_a}, lab_b={lab_b}")
88+
# logger.info(f"Received coordinates: warmCool={warm}, lightDeep={deep}, lab_l={lab_l}, lab_a={lab_a}, lab_b={lab_b}")
8989
import os
9090
from django.conf import settings
9191
with open("static/data/cluster_centers.json", "r") as f:
@@ -101,7 +101,7 @@ def recommend_by_color(request):
101101

102102
# Step 1: Find closest cluster
103103
cluster_idx = np.argmin([np.linalg.norm(coord - np.array(c)) for c in centers])
104-
logger.info(f"Closest cluster index: {cluster_idx}")
104+
# logger.info(f"Closest cluster index: {cluster_idx}")
105105

106106
# Step 2: Gather products from the cluster
107107
cluster_products = [p for p in products if p.get("cluster") == cluster_idx]
@@ -118,10 +118,10 @@ def get_feature_vec(p):
118118

119119
if len(cluster_products) >= 5:
120120
candidates = cluster_products
121-
logger.info(f"Cluster size sufficient: {len(candidates)} candidates")
121+
# logger.info(f"Cluster size sufficient: {len(candidates)} candidates")
122122
else:
123123
candidates = products
124-
logger.warning(f"Cluster {cluster_idx} has only {len(cluster_products)} products — using full dataset")
124+
# logger.warning(f"Cluster {cluster_idx} has only {len(cluster_products)} products — using full dataset")
125125

126126
similarities = []
127127
for p in candidates:
@@ -161,5 +161,5 @@ def get_feature_vec(p):
161161
return JsonResponse({"recommended": response}, json_dumps_params={"ensure_ascii": False})
162162

163163
except Exception as e:
164-
logger.exception("Recommendation error")
164+
# logger.exception("Recommendation error")
165165
return JsonResponse({"error": str(e)}, status=500)

static/js/main/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ document.addEventListener('DOMContentLoaded', function() {
110110
}
111111
})
112112
.catch(error => {
113-
console.error('Error:', error);
113+
// console.error('Error:', error);
114114
showVoteMessage('네트워크 오류가 발생했습니다.', 'error');
115115
});
116116
});

static/js/products/like_button.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ document.addEventListener('DOMContentLoaded', function () {
4242
const productId = productCard.dataset.productId;
4343

4444
if (!productId) {
45-
console.error('Error: product-card missing data-product-id attribute.');
45+
// console.error('Error: product-card missing data-product-id attribute.');
4646
return;
4747
}
4848

@@ -119,7 +119,7 @@ document.addEventListener('DOMContentLoaded', function () {
119119
}
120120
}
121121
} catch (error) {
122-
console.error('좋아요 토글 오류:', error);
122+
// console.error('좋아요 토글 오류:', error);
123123
showLikeMessage('네트워크 오류가 발생했습니다.');
124124
} finally {
125125
// 버튼 다시 활성화
@@ -196,11 +196,11 @@ document.addEventListener('DOMContentLoaded', function () {
196196
cacheTimestamp = now;
197197
return data.likes;
198198
} else {
199-
console.error('좋아요 목록 로드 실패:', data.message);
199+
// console.error('좋아요 목록 로드 실패:', data.message);
200200
return [];
201201
}
202202
} catch (error) {
203-
console.error('좋아요 목록 로드 오류:', error);
203+
// console.error('좋아요 목록 로드 오류:', error);
204204
return [];
205205
}
206206
}
@@ -232,7 +232,7 @@ document.addEventListener('DOMContentLoaded', function () {
232232
});
233233
}
234234
} catch (error) {
235-
console.error('찜 개수 업데이트 오류:', error);
235+
// console.error('찜 개수 업데이트 오류:', error);
236236
}
237237
}
238238

@@ -246,7 +246,7 @@ document.addEventListener('DOMContentLoaded', function () {
246246
const productIds = Array.from(productCards).map(card => {
247247
const id = card.dataset.productId;
248248
if (!id) {
249-
console.warn('Product card without valid product ID found, skipping:', card);
249+
// console.warn('Product card without valid product ID found, skipping:', card);
250250
return null;
251251
}
252252
return id;
@@ -292,7 +292,7 @@ document.addEventListener('DOMContentLoaded', function () {
292292
});
293293
}
294294
} catch (error) {
295-
console.error('여러 제품 찜 정보 로드 오류:', error);
295+
// console.error('여러 제품 찜 정보 로드 오류:', error);
296296
}
297297
}
298298

@@ -342,7 +342,7 @@ document.addEventListener('DOMContentLoaded', function () {
342342
// 여러 제품의 찜 정보를 한 번에 로드 (성능 개선)
343343
await loadMultipleProductsLikeInfo();
344344
} catch (error) {
345-
console.error('좋아요 상태 복원 오류:', error);
345+
// console.error('좋아요 상태 복원 오류:', error);
346346
// 실패 시 기존 방식으로 폴백
347347
try {
348348
const likes = await loadUserLikes();
@@ -352,7 +352,7 @@ document.addEventListener('DOMContentLoaded', function () {
352352
// const productId = card.dataset.productId || generateUniqueProductId(card);
353353
const productId = card.dataset.productId;
354354
if (!productId) {
355-
console.error('Missing product ID on card:', card);
355+
// console.error('Missing product ID on card:', card);
356356
return; // skip this card
357357
}
358358
const likeButton = card.querySelector('.like-button');
@@ -362,7 +362,7 @@ document.addEventListener('DOMContentLoaded', function () {
362362
}
363363
});
364364
} catch (fallbackError) {
365-
console.error('폴백 좋아요 상태 복원도 실패:', fallbackError);
365+
// console.error('폴백 좋아요 상태 복원도 실패:', fallbackError);
366366
}
367367
}
368368
}
@@ -399,14 +399,14 @@ document.addEventListener('DOMContentLoaded', function () {
399399
}
400400
}
401401
} catch (error) {
402-
console.error('개별 카드 좋아요 상태 복원 오류:', error);
402+
// console.error('개별 카드 좋아요 상태 복원 오류:', error);
403403
// 실패 시 기존 방식으로 폴백
404404
try {
405405
const likes = await loadUserLikes();
406406
// const productId = card.dataset.productId || generateUniqueProductId(card);
407407
const productId = card.dataset.productId;
408408
if (!productId) {
409-
console.error('Missing product ID on card:', card);
409+
// console.error('Missing product ID on card:', card);
410410
return; // skip this card
411411
}
412412
const likeButton = card.querySelector('.like-button');
@@ -415,7 +415,7 @@ document.addEventListener('DOMContentLoaded', function () {
415415
likeButton.classList.add('liked');
416416
}
417417
} catch (fallbackError) {
418-
console.error('폴백 개별 카드 복원도 실패:', fallbackError);
418+
// console.error('폴백 개별 카드 복원도 실패:', fallbackError);
419419
}
420420
}
421421
}
@@ -503,7 +503,7 @@ async function getLikedProducts() {
503503
const data = await response.json();
504504
return data.success ? data.likes : [];
505505
} catch (error) {
506-
console.error('좋아요 목록 조회 오류:', error);
506+
// console.error('좋아요 목록 조회 오류:', error);
507507
return [];
508508
}
509509
}
@@ -521,7 +521,7 @@ async function clearLikedProducts() {
521521
const data = await response.json();
522522
return data.success;
523523
} catch (error) {
524-
console.error('좋아요 목록 초기화 오류:', error);
524+
// console.error('좋아요 목록 초기화 오류:', error);
525525
return false;
526526
}
527527
}
@@ -538,7 +538,7 @@ document.addEventListener('DOMContentLoaded', function () {
538538
// const productId = card.dataset.productId || generateUniqueProductId(card);
539539
const productId = card.dataset.productId;
540540
if (!productId) {
541-
console.error('Missing product ID on card:', card);
541+
// console.error('Missing product ID on card:', card);
542542
return; // skip this card
543543
}
544544
const productName = getProductName(card);

static/js/products/rating.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class ProductRating {
127127
// this.loadRatingsList();
128128
}
129129
} catch (error) {
130-
console.error('별점 데이터 로드 실패:', error);
130+
// console.error('별점 데이터 로드 실패:', error);
131131
}
132132
}
133133

@@ -260,7 +260,7 @@ class ProductRating {
260260
alert(errorData.error || '별점 저장에 실패했습니다.');
261261
}
262262
} catch (error) {
263-
console.error('별점 제출 실패:', error);
263+
// console.error('별점 제출 실패:', error);
264264
alert('별점 저장 중 오류가 발생했습니다.');
265265
} finally {
266266
submitBtn.disabled = false;
@@ -304,7 +304,7 @@ class ProductRating {
304304
alert(errorData.error || '리뷰 삭제에 실패했습니다.');
305305
}
306306
} catch (error) {
307-
console.error('리뷰 삭제 실패:', error);
307+
// console.error('리뷰 삭제 실패:', error);
308308
alert('리뷰 삭제 중 오류가 발생했습니다.');
309309
}
310310
}

static/js/products/rating_images.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ window.createImagePreviewBox = (id, url, isExisting = false) => {
7171
alert('이미지 삭제에 실패했습니다.');
7272
}
7373
} catch (error) {
74-
console.error('이미지 삭제 오류:', error);
74+
// console.error('이미지 삭제 오류:', error);
7575
alert('이미지 삭제 중 오류가 발생했습니다.');
7676
}
7777
} else {

static/js/recommendation/color_analyzer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ document.addEventListener('DOMContentLoaded', () => {
422422
renderRecommendations(data.recommended);
423423
displayRecommendationsOnMatrix(data.recommended);
424424
} else {
425-
console.warn("No recommended field in response", data);
425+
// console.warn("No recommended field in response", data);
426426
}
427427
// console.log(data.recommended);
428428
})

0 commit comments

Comments
 (0)