mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Add tracing to Bun.write operations
Added tracing in WriteFile.doWrite() to track all writes through Bun.write, logging fd, buffer length, and bytes written/errno. Verified fs tracing works with sync operations (openSync, writeSync, closeSync). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -130,6 +130,15 @@ pub const WriteFile = struct {
|
||||
// non-seekable file.
|
||||
bun.sys.write(fd, buffer);
|
||||
|
||||
// Trace the write operation
|
||||
if (Output.trace_enabled) {
|
||||
const tracer = Output.tracer("bun_write");
|
||||
switch (result) {
|
||||
.result => |bytes| tracer.trace(.{ .call = "write", .fd = fd.cast(), .length = buffer.len, .bytes_written = bytes }),
|
||||
.err => |err| tracer.trace(.{ .call = "write", .fd = fd.cast(), .length = buffer.len, .errno = err.errno }),
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
switch (result) {
|
||||
.result => |res| {
|
||||
|
||||
Reference in New Issue
Block a user