implement sentry transport to write crash reports to XDG_STATE_HOME

This commit is contained in:
Mitchell Hashimoto
2024-08-27 19:29:34 -07:00
parent e029490535
commit 2abdf291f4
5 changed files with 58 additions and 3 deletions

View File

@@ -7,4 +7,12 @@ pub const Envelope = opaque {
pub fn deinit(self: *Envelope) void {
c.sentry_envelope_free(@ptrCast(self));
}
pub fn writeToFile(self: *Envelope, path: []const u8) !void {
if (c.sentry_envelope_write_to_file_n(
@ptrCast(self),
path.ptr,
path.len,
) != 0) return error.WriteFailed;
}
};

View File

@@ -6,6 +6,10 @@ const c = @import("c.zig").c;
pub const UUID = struct {
value: c.sentry_uuid_t,
pub fn init() UUID {
return .{ .value = c.sentry_uuid_new_v4() };
}
pub fn isNil(self: UUID) bool {
return c.sentry_uuid_is_nil(&self.value) != 0;
}