Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/espadrine/multilog
A fun and collateral way to print logs!
https://github.com/espadrine/multilog
Last synced: 10 days ago
JSON representation
A fun and collateral way to print logs!
- Host: GitHub
- URL: https://github.com/espadrine/multilog
- Owner: espadrine
- Created: 2012-05-23T16:57:12.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-11-22T10:12:25.000Z (almost 10 years ago)
- Last Synced: 2024-08-09T18:58:01.937Z (3 months ago)
- Language: JavaScript
- Size: 227 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Multilog
_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!## API
```js
var log = require('multilog');
log('Curse your sudden but inevitable betrayal!', 'stderr');
```You get the following functions:
- `log(statement, tag)` function prints `statement` in `tag` channel
(defaulting to the special "stdout" channel).
- `log.pipe(parentTag, tag)` makes all `parentTag` statements be on the `tag`
channel.
- `log.unpipe(parentTag, tag)` undoes the corresponding `pipe` operation.By default, pipes flow into void.
You can connect them to [a writable stream][Stream]
with `log.pipe(tag, process.stdout)`.You can also ask that their logs be retained with `log.retain(tag)`.
You can then read from them (and from all tags that feeds to them)
through `log.read(tag)`, and flush the memory with `log.flush(tag)`.Advanced use:
- `log.tags(statement, tagList)` prints `statement` on multiple tags.
- `log.stream(tag)` returns a duplex [Stream][] for a retained tag.There are two special tags, `stdout` and `stderr`, which directly flush their
statements to the corresponding pipeline.[Stream]: http://nodejs.org/api/stream.html
## Authorship