debug-log
Printf-style debug logging for development-time visibility
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Debug Log
Printf-style logging for development and debugging. Compiles away completely in release builds.
Purpose
- Development-time visibility into program state
- Add arbitrary trace points during debugging
- Zero overhead in release builds
Usage
#include "debug_log.h"
DEBUG_LOG("value=%d state=%s", x, state_name);
DEBUG_LOG("=== Entering function ===");
DEBUG_LOG("buffer contents: %.*s", (int)len, buf);
Build Configuration
| Build | DEBUG defined | Behavior |
|---|---|---|
| Debug | Yes | Writes to IKIGAI_DEBUG.LOG |
| Release | No | Compiles to ((void)0) - removed entirely |
Initialization
In debug builds, call once early in main():
#ifdef DEBUG
ik_debug_log_init();
#endif
Or simply use the macro form (safe in any build):
ik_debug_log_init(); // No-op if DEBUG not defined
Output Format
[2025-01-15 10:30:00] src/client.c:34:main: === Session starting, PID=12345 ===
Format: [timestamp] file:line:function: message
Log Location
- File:
IKIGAI_DEBUG.LOGin working directory - Truncated on each run (via
ik_debug_log_init)
Inspecting Logs
tail -f IKIGAI_DEBUG.LOG
Alternate Buffer Note
ikigai runs in terminal alternate buffer mode. printf() and fprintf(stderr, ...) are not visible during execution. Use DEBUG_LOG instead.
Source Files
-
src/debug_log.h- Macro definition -
src/debug_log.c- Implementation (excluded from coverage)
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!