devvit-logs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDevvit Logs
Devvit 日志
Stream log events from an installed Devvit app for quick debugging. This skill wraps and auto-exits after a short window (5 seconds) to avoid hanging on a streaming command.
devvit logs流式传输已安装Devvit应用的日志事件,以便快速调试。该技能封装了命令,并会在短时间窗口(5秒)后自动退出,避免流式命令挂起。
devvit logsHow It Works
工作原理
- Ask the user for the target subreddit (required).
- Optionally accept an app name and flag.
--since=... - Run and capture output.
devvit logs - Exit automatically after the first burst of output or 5 seconds, whichever comes first.
- 询问用户目标subreddit(必填)。
- 可选择接受应用名称和参数。
--since=... - 运行并捕获输出。
devvit logs - 在首次输出爆发或5秒后自动退出,以先到者为准。
Usage
使用方法
bash
node ./scripts/devvit-logs.cjs <subreddit> [app-name] [--since=1h]Script path is relative to this skill's directory.
Arguments:
- - Required. Subreddit to stream logs from.
subreddit - - Optional. App name if streaming from another folder.
app-name - - Optional. Historical logs window (e.g.,
--since=Xd,--since=30m).--since=1d
Examples:
bash
node ./scripts/devvit-logs.cjs my-subreddit
node ./scripts/devvit-logs.cjs my-subreddit my-app --since=1hbash
node ./scripts/devvit-logs.cjs <subreddit> [app-name] [--since=1h]脚本路径相对于该技能的目录。
参数:
- - 必填。要流式传输日志的subreddit。
subreddit - - 可选。如果从其他文件夹流式传输,需提供应用名称。
app-name - - 可选。历史日志时间窗口(例如
--since=Xd、--since=30m)。--since=1d
示例:
bash
node ./scripts/devvit-logs.cjs my-subreddit
node ./scripts/devvit-logs.cjs my-subreddit my-app --since=1hOutput
输出
json
{
"ok": true,
"reason": "timeout",
"exitCode": null,
"signal": null,
"stdout": "=============================== streaming logs for my-app on my-subreddit ================================\n[DEBUG] Dec 8 15:55:23 Action called!",
"stderr": ""
}json
{
"ok": true,
"reason": "timeout",
"exitCode": null,
"signal": null,
"stdout": "=============================== streaming logs for my-app on my-subreddit ================================\n[DEBUG] Dec 8 15:55:23 Action called!",
"stderr": ""
}Present Results to User
向用户展示结果
- If the user did not provide a subreddit, ask for it explicitly.
- Summarize the captured logs (if any) and mention the 5-second capture window.
- If no logs were captured, say so and suggest retrying with activity or .
--since=...
- 如果用户未提供subreddit,明确询问。
- 总结捕获到的日志(如有),并提及5秒捕获窗口。
- 如果未捕获到日志,告知用户并建议触发应用活动或使用参数重试。
--since=...
Troubleshooting
故障排除
- Devvit CLI not found: Install or ensure is in PATH.
devvit - Not logged in: Run and try again.
devvit login - No logs: Trigger an action in the app or use .
--since=... - Permission errors: Confirm the app is installed in the subreddit and you have access.
- 未找到Devvit CLI:安装Devvit或确保在系统PATH中。
devvit - 未登录:运行后重试。
devvit login - 无日志:触发应用中的操作或使用参数。
--since=... - 权限错误:确认应用已安装在该subreddit中,且你有访问权限。