Files
bun.sh/src/sql/postgres/DebugSocketMonitorReader.zig
taylor.fish 41b1efe12c Rename disabled parameter in Output.scoped (#21769)
It's very confusing.

(For internal tracking: fixes STAB-977)
2025-08-11 20:19:34 -07:00

24 lines
605 B
Zig

var file: std.fs.File = undefined;
pub var enabled = false;
pub var check = std.once(load);
pub fn load() void {
if (bun.getenvZAnyCase("BUN_POSTGRES_SOCKET_MONITOR_READER")) |monitor| {
enabled = true;
file = std.fs.cwd().createFile(monitor, .{ .truncate = true }) catch {
enabled = false;
return;
};
debug("duplicating reads to {s}", .{monitor});
}
}
pub fn write(data: []const u8) void {
file.writeAll(data) catch {};
}
const debug = bun.Output.scoped(.Postgres, .visible);
const bun = @import("bun");
const std = @import("std");