ludic.telemetry: telemetry_str_open - a named string property the caller writes into the kept buffer (a look's numbers)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
78a70765af
commit
f74738a4e0
2 changed files with 10 additions and 1 deletions
|
|
@ -28,6 +28,12 @@ export function telemetry_item_open(p: TelemetryProps) -> StrBuf {
|
||||||
return p.sb
|
return p.sb
|
||||||
}
|
}
|
||||||
export function telemetry_item_close(p: TelemetryProps) -> void { sb_byte(p.sb, 34) }
|
export function telemetry_item_close(p: TelemetryProps) -> void { sb_byte(p.sb, 34) }
|
||||||
|
# the same for a named string property; closed with telemetry_item_close
|
||||||
|
export function telemetry_str_open(p: TelemetryProps, k: string) -> StrBuf {
|
||||||
|
tp_key(p, k)
|
||||||
|
sb_byte(p.sb, 34)
|
||||||
|
return p.sb
|
||||||
|
}
|
||||||
|
|
||||||
# a number standing for what has been written: equal when the bytes are (FNV-1a, 31 bits)
|
# a number standing for what has been written: equal when the bytes are (FNV-1a, 31 bits)
|
||||||
export function telemetry_props_sig(p: TelemetryProps) -> int {
|
export function telemetry_props_sig(p: TelemetryProps) -> int {
|
||||||
|
|
|
||||||
|
|
@ -109,11 +109,14 @@ program RingTest {
|
||||||
telemetry_item_close(p)
|
telemetry_item_close(p)
|
||||||
telemetry_list_end(p)
|
telemetry_list_end(p)
|
||||||
telemetry_obj_end(p)
|
telemetry_obj_end(p)
|
||||||
|
let lk = telemetry_str_open(p, "look")
|
||||||
|
sb_int(lk, 7)
|
||||||
|
telemetry_item_close(p)
|
||||||
telemetry_bool(p, "last", false)
|
telemetry_bool(p, "last", false)
|
||||||
let sig = telemetry_props_sig(p)
|
let sig = telemetry_props_sig(p)
|
||||||
telemetry_event(telemetry_st, "shot", p)
|
telemetry_event(telemetry_st, "shot", p)
|
||||||
let a = telemetry_line(telemetry_st, 0)
|
let a = telemetry_line(telemetry_st, 0)
|
||||||
expect(Text.contains(a, "{\"grade\":3,\"subjects\":[\"elk\",\"deer\"],\"$set\":{\"arch\":\"arm64\",\"looks\":[\"4,2\"]},\"last\":false,"))
|
expect(Text.contains(a, "{\"grade\":3,\"subjects\":[\"elk\",\"deer\"],\"$set\":{\"arch\":\"arm64\",\"looks\":[\"4,2\"]},\"look\":\"7\",\"last\":false,"))
|
||||||
expect(Json.parse(a) != null)
|
expect(Json.parse(a) != null)
|
||||||
let q = telemetry_props(telemetry_st)
|
let q = telemetry_props(telemetry_st)
|
||||||
telemetry_int(q, "grade", 3)
|
telemetry_int(q, "grade", 3)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue