logging
デバッグしやすいログの実装ガイド
When & Why to Use This Skill
This Claude skill provides a comprehensive guide for implementing structured logging to simplify the debugging process. It focuses on creating logs that clearly track execution flow and identify specific points of failure, enabling developers to troubleshoot production issues more efficiently by providing clear visibility into the application's state.
Use Cases
- Troubleshooting complex asynchronous data processing flows by tracking start, progress, and completion states with contextual metadata.
- Improving error visibility in production environments by capturing specific input data and error details alongside stack traces.
- Standardizing logging practices across a development team to ensure consistent, actionable, and searchable log data for faster incident resolution.
| name | logging |
|---|---|
| description | デバッグしやすいログの実装ガイド |
ロギングガイド
コード例
function processData(input) {
logger.info('processData started', { input });
try {
const result = await fetchFromDB(id);
logger.info('DB fetch succeeded', { id, result });
const processed = transform(result);
logger.info('processData completed', { processed });
return processed;
} catch (error) {
logger.error('processData failed', { input, error });
throw error;
}
}
目的
「どこまで成功したか」を特定できるログにする。