chore(debug): 미사용 debugCapture 유틸 제거
LOW-PITCH-DIAG 진단 제거로 debugCapture 사용처가 0 이 되었고, 대상 /api/debug 라우트도 구현된 적이 없어 한 번도 동작하지 않던 죽은 코드다. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
707148ed0f
commit
0c1c66f65c
@ -1,44 +0,0 @@
|
||||
// util/debugCapture.js
|
||||
// 디버그 모드에서 상태/오브젝트를 파일로 저장하고 Claude가 읽을 수 있게 함
|
||||
// 사용법:
|
||||
// import { debugCapture } from '@/util/debugCapture'
|
||||
// debugCapture.state('rackInfos', rackInfos) // 오브젝트 스냅샷 저장
|
||||
// debugCapture.error('fetchFailed', error, context) // 에러 저장
|
||||
// debugCapture.log('step label', someData) // 로그 저장
|
||||
|
||||
const isLoggingEnabled = process.env.NEXT_PUBLIC_ENABLE_LOGGING === 'true'
|
||||
|
||||
async function send(type, label, data) {
|
||||
if (!isLoggingEnabled || typeof window === 'undefined') return
|
||||
try {
|
||||
await fetch('/api/debug', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ type, label, data, timestamp: new Date().toISOString() }),
|
||||
})
|
||||
} catch {}
|
||||
}
|
||||
|
||||
export const debugCapture = {
|
||||
// 오브젝트/상태 스냅샷 - debug/debug-snapshot.json 에 저장
|
||||
state: (label, obj) => send('snapshot', label, obj),
|
||||
|
||||
// 에러 캡처 - debug/debug-errors.json 에 저장
|
||||
error: (label, error, context = null) =>
|
||||
send('error', label, {
|
||||
message: error?.message ?? String(error),
|
||||
stack: error?.stack ?? null,
|
||||
context,
|
||||
}),
|
||||
|
||||
// 일반 로그 - debug/debug.log 에 저장
|
||||
log: (label, data) => send('log', label, data),
|
||||
|
||||
// 디버그 파일 전체 초기화
|
||||
clear: async () => {
|
||||
if (!isLoggingEnabled || typeof window === 'undefined') return
|
||||
try {
|
||||
await fetch('/api/debug', { method: 'DELETE' })
|
||||
} catch {}
|
||||
},
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user