slightly improve logs (#8767)

Hello

This is a small thing I noticed when building Ghostty. The logs for
SetTitle and Pwd are unreadable due to them being shown as an array of
integers, so I added a custom formatter for them to be shows as text.
This commit is contained in:
Mitchell Hashimoto
2025-09-18 15:28:24 -07:00
committed by GitHub

View File

@@ -569,6 +569,15 @@ pub const SetTitle = struct {
.title = self.title.ptr,
};
}
pub fn format(
value: @This(),
comptime _: []const u8,
_: std.fmt.FormatOptions,
writer: anytype,
) !void {
try writer.print("{s}{{ {s} }}", .{ @typeName(@This()), value.title });
}
};
pub const Pwd = struct {
@@ -584,6 +593,15 @@ pub const Pwd = struct {
.pwd = self.pwd.ptr,
};
}
pub fn format(
value: @This(),
comptime _: []const u8,
_: std.fmt.FormatOptions,
writer: anytype,
) !void {
try writer.print("{s}{{ {s} }}", .{ @typeName(@This()), value.pwd });
}
};
/// The desktop notification to show.
@@ -603,6 +621,19 @@ pub const DesktopNotification = struct {
.body = self.body.ptr,
};
}
pub fn format(
value: @This(),
comptime _: []const u8,
_: std.fmt.FormatOptions,
writer: anytype,
) !void {
try writer.print("{s}{{ title: {s}, body: {s} }}", .{
@typeName(@This()),
value.title,
value.body,
});
}
};
pub const KeySequence = union(enum) {