Tracing
I only added some output to the parser and ast-lowering so we can test the filtering. I think adding more can be done as needed.
Filtering is done via the SPADE_LOG env variable. Its documentation can be found over at https://docs.rs/tracing-subscriber/0.3.11/tracing_subscriber/filter/struct.EnvFilter.html but summarized: we can do SPADE_LOG="info"
to get everything at INFO and higher, or SPADE_LOG="spade_parser=debug"
to get everything at DEBUG and higher but only in spade_parser. It can also be combined, so e.g. SPADE_LOG="spade_parser=debug,info"
for everything at INFO and higher and additionally DEBUG from spade_parser. The default is to not output anything.
This isn't a replacement for trace_parser
right now, but I think it could be if we want it to. It would require a bunch of infos but it might be worth it to unify at some point.
Additional notes:
- We use https://github.com/davidbarsky/tracing-tree/pull/44 since otherwise it prints one newline per span exit.
-
#[tracing::instrument]
has a default level of INFO which can be overriden per function. See https://gitlab.com/spade-lang/spade/-/blob/414cd164c73c31ddeefb85daf6077147e365b5a6/spade-parser/src/lib.rs#L102.
Closes #158 (closed)