various small api fixes/tweaks

This commit is contained in:
Karl Seguin
2025-11-24 20:12:43 +08:00
parent 871fd46c89
commit e336c67857
17 changed files with 327 additions and 131 deletions

View File

@@ -33,19 +33,12 @@ pub const Scope = enum {
http,
page,
js,
loop,
event,
scheduler,
not_implemented,
script_event,
telemetry,
user_script,
unknown_prop,
web_api,
xhr,
fetch,
polyfill,
interceptor,
unknown_prop,
};
const Opts = struct {
@@ -394,7 +387,7 @@ test "log: data" {
const string = try testing.allocator.dupe(u8, "spice_must_flow");
defer testing.allocator.free(string);
try logTo(.http, .warn, "a msg", .{
try logTo(.page, .warn, "a msg", .{
.cint = 5,
.cfloat = 3.43,
.int = @as(i16, -49),
@@ -409,7 +402,7 @@ test "log: data" {
.level = Level.warn,
}, &aw.writer);
try testing.expectEqual("$time=1739795092929 $scope=http $level=warn $msg=\"a msg\" " ++
try testing.expectEqual("$time=1739795092929 $scope=page $level=warn $msg=\"a msg\" " ++
"cint=5 cfloat=3.43 int=-49 float=0.0003232 bt=true bf=false " ++
"nn=33 n=null lit=over9000! slice=spice_must_flow " ++
"err=Nope level=warn\n", aw.written());