Repository navigation
common: add LOG_JSON macro to log structured data - #28586
Conversation
|
I'm merging this today as it's a nice-to-have addition, no impacts to existing code. For context, this is similar to The long-term plan of this feature is to allow an external app to interact with |
ggerganov
left a comment
There was a problem hiding this comment.
Maybe the logs that would be consumed by third-parties would need to carry a version per each log to be able to handle breaking changes.
|
@ggerganov I thought about versioning but probably it's not very important for now. JSON is quite forgiving, so breaking changes are probably rare (i.e. removing a field) We can also add a code review rule says "try avoiding breaking changes in JSON output" in general, which also apply to all HTTP JSON responses from server, but let's see a bit later |
* add LOG_JSON macro * fit: add demo LOG_JSON
Overview
Cont #28437 and supersede #23676
The way it works:
log.hexposes aLOG_JSONmacro, note that it does NOT replace otherLOG_*macros, but is purely an additive change--log-jsonlis settypeNormal log lines will have
type == "log", but specific struct will have specific typeAs an example,
common_memory_break_printnow outputs this when--log-jsonlis set:{"type":"fit_memory_breakdown","data":{"unit":"MiB","rows":[{"kind":"device","name":"MTL0","description":"Apple M5 Max","total":110100,"free":110100,"self":5749,"model":2883,"context":2148,"compute":718,"unaccounted":-5749},{"kind":"host","name":"Host","self":2531,"model":2208,"context":0,"compute":323}]}}Requirements