diff options
| author | Mitchell Hashimoto <m@mitchellh.com> | 2024-08-27 19:29:34 -0700 |
|---|---|---|
| committer | Mitchell Hashimoto <m@mitchellh.com> | 2024-08-28 21:43:18 -0700 |
| commit | 2abdf291f4fef930d802b6fc4017ec45c9aa0ba0 (patch) | |
| tree | 7948fe42845c33901d877c3669bc8b9eb0c58ade /pkg | |
| parent | e029490535c6750d0b0319cbf36453a326e2499d (diff) | |
implement sentry transport to write crash reports to XDG_STATE_HOME
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/sentry/envelope.zig | 8 | ||||
| -rw-r--r-- | pkg/sentry/uuid.zig | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/pkg/sentry/envelope.zig b/pkg/sentry/envelope.zig index 38253f290..d40a8d9fb 100644 --- a/pkg/sentry/envelope.zig +++ b/pkg/sentry/envelope.zig @@ -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; + } }; diff --git a/pkg/sentry/uuid.zig b/pkg/sentry/uuid.zig index d1e234dda..3f1c06704 100644 --- a/pkg/sentry/uuid.zig +++ b/pkg/sentry/uuid.zig @@ -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; } |
