devvit-logs

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Devvit Logs

Devvit 日志

Stream log events from an installed Devvit app for quick debugging. This skill wraps
devvit logs
and auto-exits after a short window (5 seconds) to avoid hanging on a streaming command.
流式传输已安装Devvit应用的日志事件,以便快速调试。该技能封装了
devvit logs
命令,并会在短时间窗口(5秒)后自动退出,避免流式命令挂起。

How It Works

工作原理

  1. Ask the user for the target subreddit (required).
  2. Optionally accept an app name and
    --since=...
    flag.
  3. Run
    devvit logs
    and capture output.
  4. Exit automatically after the first burst of output or 5 seconds, whichever comes first.
  1. 询问用户目标subreddit(必填)。
  2. 可选择接受应用名称和
    --since=...
    参数。
  3. 运行
    devvit logs
    并捕获输出。
  4. 在首次输出爆发或5秒后自动退出,以先到者为准。

Usage

使用方法

bash
node ./scripts/devvit-logs.cjs <subreddit> [app-name] [--since=1h]
Script path is relative to this skill's directory.
Arguments:
  • subreddit
    - Required. Subreddit to stream logs from.
  • app-name
    - Optional. App name if streaming from another folder.
  • --since=Xd
    - Optional. Historical logs window (e.g.,
    --since=30m
    ,
    --since=1d
    ).
Examples:
bash
node ./scripts/devvit-logs.cjs my-subreddit
node ./scripts/devvit-logs.cjs my-subreddit my-app --since=1h
bash
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=1h

Output

输出

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
    devvit
    is in PATH.
  • Not logged in: Run
    devvit login
    and try again.
  • 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或确保
    devvit
    在系统PATH中。
  • 未登录:运行
    devvit login
    后重试。
  • 无日志:触发应用中的操作或使用
    --since=...
    参数。
  • 权限错误:确认应用已安装在该subreddit中,且你有访问权限。