mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 12:51:54 +00:00
24 lines
605 B
Zig
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");
|