preview2-prototyping icon indicating copy to clipboard operation
preview2-prototyping copied to clipboard

wasi log context as optional

Open guybedford opened this issue 3 years ago • 3 comments

I wonder if it might be worth making the "context" argument for wasi logging entirely optional?

This way, both global and contextual logging could be supported.

guybedford avatar Jan 12 '23 01:01 guybedford

This certainly makes sense from the perspective of "stderr", a concept shared by many programming languages, which is conceptually a "global " log.

I don't know if it generalizes beyond that though. I've sketched up a wasi-stderr API to cover the stderr case (and also fix the newline issue). If that makes sense, then perhaps wasi-logging should just focus on the contextual logging case?

sunfishcode avatar Jan 12 '23 01:01 sunfishcode

Assuming stderr can be fully relied upon for the general case in this way, then that distinction makes sense to me.

guybedford avatar Jan 12 '23 21:01 guybedford

Stderr now uses a dedicated wasi-stderr interface rather than using wasi-logging, so it no longer requires a context and no longer prints extra noisy output.

sunfishcode avatar Feb 06 '23 13:02 sunfishcode