summaryrefslogtreecommitdiff
path: root/pkg/sentry/main.zig
blob: 35fc57dfe6ee58f542a5f36856382dbc0e1918cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pub const c = @import("c.zig").c;

const transport = @import("transport.zig");

pub const Envelope = @import("envelope.zig").Envelope;
pub const Level = @import("level.zig").Level;
pub const Transport = transport.Transport;
pub const Value = @import("value.zig").Value;
pub const UUID = @import("uuid.zig").UUID;

pub fn captureEvent(value: Value) ?UUID {
    const uuid: UUID = .{ .value = c.sentry_capture_event(value.value) };
    if (uuid.isNil()) return null;
    return uuid;
}

pub fn setContext(key: []const u8, value: Value) void {
    c.sentry_set_context_n(key.ptr, key.len, value.value);
}

pub fn removeContext(key: []const u8) void {
    c.sentry_remove_context_n(key.ptr, key.len);
}

pub fn setTag(key: []const u8, value: []const u8) void {
    c.sentry_set_tag_n(key.ptr, key.len, value.ptr, value.len);
}

pub fn free(ptr: *anyopaque) void {
    c.sentry_free(ptr);
}

test {
    @import("std").testing.refAllDecls(@This());
}