アプリケーションログの実装ガイド。デバッグしやすいログを適切なタイミングで出力する。
/plugin marketplace add shin902/shi-marketplace/plugin install openspec@Marketplace-of-shiThis skill inherits all available tools. When active, it can use any tool Claude has access to.
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;
}
}
「どこまで成功したか」を特定できるログにする。