v0.0.7 | Change logging from print to logger
All checks were successful
Build And Test / build-and-push (push) Successful in 35s

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-14 11:51:04 +09:00
parent 4f9cb872a9
commit 10ba64d3d1
2 changed files with 8 additions and 13 deletions

View File

@ -1,7 +1,6 @@
# nhn_prj/middleware.py
import logging
import time
import sys
logger = logging.getLogger(__name__)
@ -16,22 +15,20 @@ class RequestLoggingMiddleware:
# 요청 시작 시간
start_time = time.time()
# 표준출력으로 직접 출력
print(
# 요청 정보 로깅
logger.info(
f"[REQUEST] {request.method} {request.path} "
f"| Host: {request.get_host()} "
f"| IP: {self.get_client_ip(request)}",
file=sys.stdout,
flush=True
f"| IP: {self.get_client_ip(request)}"
)
# 헤더 로깅 (디버깅용)
# NHN 헤더 로깅
nhn_headers = {
k: v for k, v in request.headers.items()
if k.lower().startswith('x-nhn')
}
if nhn_headers:
print(f"[HEADERS] NHN Headers: {nhn_headers}", file=sys.stdout, flush=True)
logger.info(f"[HEADERS] NHN Headers: {nhn_headers}")
# 응답 처리
response = self.get_response(request)
@ -40,12 +37,10 @@ class RequestLoggingMiddleware:
duration = time.time() - start_time
# 응답 정보 로깅
print(
logger.info(
f"[RESPONSE] {request.method} {request.path} "
f"| Status: {response.status_code} "
f"| Duration: {duration:.3f}s",
file=sys.stdout,
flush=True
f"| Duration: {duration:.3f}s"
)
return response

View File

@ -1 +1 @@
v0.0.6
v0.0.7