Tagged logging. Includes multi-streamed logging and filtering.
a fun and collateral way to print logs
Each statement you log is associated to a tag, and some tags can be associated to writable streams.
You can also file tags under other tags, so that all statements in a child tag are printed to the parent tag's writable stream!
var log = ;;
You get the following functions:
log(statement, tag)function prints
tagchannel (defaulting to the special "stdout" channel).
log.pipe(parentTag, tag)makes all
parentTagstatements be on the
log.unpipe(parentTag, tag)undoes the corresponding
By default, pipes flow into void.
You can connect them to a writable stream
You can also ask that their logs be retained with
You can then read from them (and from all tags that feeds to them)
log.read(tag), and flush the memory with
statementon multiple tags.
log.stream(tag)returns a duplex Stream for a retained tag.
There are two special tags,
stderr, which directly flush their
statements to the corresponding pipeline.