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.pull/8776/head
commit
77b39c45a6
|
|
@ -569,6 +569,15 @@ pub const SetTitle = struct {
|
||||||
.title = self.title.ptr,
|
.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 {
|
pub const Pwd = struct {
|
||||||
|
|
@ -584,6 +593,15 @@ pub const Pwd = struct {
|
||||||
.pwd = self.pwd.ptr,
|
.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.
|
/// The desktop notification to show.
|
||||||
|
|
@ -603,6 +621,19 @@ pub const DesktopNotification = struct {
|
||||||
.body = self.body.ptr,
|
.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) {
|
pub const KeySequence = union(enum) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue