mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 20:09:04 +00:00
Implements BUN_WATCHER_TRACE env var that logs all file watcher events to a file in JSON format. When set, the watcher appends detailed event information including timestamp, file path, and operation flags (write, delete, rename, metadata, move_to) plus any changed filenames. The trace file is opened once during watcher initialization in append mode, allowing events to persist across multiple runs of bun --watch or bun --hot. This is useful for debugging watch-related issues. Example usage: BUN_WATCHER_TRACE=/tmp/watch.log bun --watch script.js Each line in the trace file is a JSON object with: - timestamp: millisecond timestamp - index: watch item index - path: absolute file path being watched - delete/write/rename/metadata/move_to: boolean operation flags - changed_files: array of filenames that changed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>