diagnostic-logs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDiagnostic Logs
诊断日志
Format
格式
typescript
console.log('[IDENTIFIER] Clear purpose message', JSON.stringify({ object: data }));typescript
console.log('[IDENTIFIER] Clear purpose message', JSON.stringify({ object: data }));Requirements
要求
- Clear purpose - What is this log telling you?
- Single filterable identifier - prefix (e.g.,
[UPPER_CASE],[THUMB_STRIP])[RENDER] - Stringified objects - Use for easy copying from browser console
JSON.stringify() - Remove when done - Delete diagnostic logs after debugging is complete
- 明确用途 - 这条日志要传达什么信息?
- 单一可过滤标识符 - 前缀(例如:
[大写形式]、[THUMB_STRIP])[RENDER] - 序列化对象 - 使用以便于从浏览器控制台复制
JSON.stringify() - 调试完成后移除 - 调试结束后删除诊断日志
Examples
示例
typescript
// ✅ Good
console.log('[THUMB_STRIP] Starting animation', JSON.stringify({
loadingCount: 3,
totalSlots: 10
}));
// ❌ Bad - no identifier, object not stringified
console.log('Starting animation', { loadingCount: 3 });typescript
// ✅ 规范示例
console.log('[THUMB_STRIP] Starting animation', JSON.stringify({
loadingCount: 3,
totalSlots: 10
}));
// ❌ 不规范示例 - 无标识符,对象未序列化
console.log('Starting animation', { loadingCount: 3 });