Sima
Sima is a super simple JSON logging library. if you are enjoying with Stream
, you will love it.
var sima = ; sima ; sima;
Installation
$ npm i --save sima$ npm i -g sima # command line tool
How to write data to Sima?
Basic
sima;sima;
As a stream
Sima is a PassThrough
stream, so you can use write
method directly or pipe
other Readable
stream to Sima, for example:
sima;sima;sima;sima; duplex;duplex;
How to output data to console/file?
We can't pipe
sima to process.stdout
, because sima outputs Object
s not String
s:
sima;
Therefore, we need to convert Object
to String
:
// json stringsima ; // pretty print sima ;
CLI Usage
Pretty Print
$ cat sima.log | sima$ cat sima.log | sima --format '[{{time}}] {{upperName}} {{app}}: {{!msg}}'
Filter/Search
$ cat sima.log | sima --filter '/hello/.test(data.msg)'