Comparing version
@@ -13,5 +13,10 @@ { | ||
}, | ||
"bin": "./dist/bin/index.js", | ||
"dependencies": { | ||
"boolean": "^0.1.3", | ||
"sprintf-js": "^1.1.1" | ||
"chalk": "^2.1.0", | ||
"prettyjson": "^1.2.1", | ||
"split2": "^2.2.0", | ||
"sprintf-js": "^1.1.1", | ||
"yargs": "^9.0.1" | ||
}, | ||
@@ -72,3 +77,3 @@ "description": "JSON logger for Node.js.", | ||
}, | ||
"version": "1.2.1" | ||
"version": "1.3.0" | ||
} |
@@ -23,2 +23,3 @@ # Roarr | ||
* [`fatal`](#fatal) | ||
* [CLI tool](#cli-tool) | ||
* [Transports](#transports) | ||
@@ -239,2 +240,35 @@ * [Environment variables](#environment-variables) | ||
## CLI tool | ||
Roarr comes with a CLI tool used to pretty-print logs for development purposes. | ||
To format the logs, pipe the program output to `roarr` program, e.g. | ||
```bash | ||
$ npm install roarr -g | ||
$ ROARR_LOG=true node index.js | roarr | ||
``` | ||
Provided that the `index.js` program produced an output such as: | ||
``` | ||
{"context":{"package":"forward-proxy","namespace":"createHttpProxyServer","logLevel":"info"},"message":"Internal SSL Server running on localhost:62597","sequence":0,"time":1506803138704,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createRequestProcessor","logLevel":"info"},"message":"request start -> http://localhost:62595/","sequence":1,"time":1506803138741,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createLogInterceptor","logLevel":"debug","headers":{"host":"localhost:62595","connection":"close"}},"message":"received request","sequence":2,"time":1506803138741,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createRequestProcessor","logLevel":"info"},"message":"request finished <- http://localhost:62595/","sequence":3,"time":1506803138749,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createLogInterceptor","logLevel":"info","method":"GET","requestHeaders":{"host":"localhost:62595","connection":"close"},"responseHeaders":{"date":"Sat, 30 Sep 2017 20:25:38 GMT","connection":"close","content-length":"7","x-forward-proxy-request-id":"2b746d92-1a8b-4f36-b3cc-5bff57dad94d","x-forward-proxy-cache-hit":"false"},"statusCode":200,"url":"http://localhost:62595/"},"message":"response","sequence":4,"time":1506803138755,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createLogInterceptor","logLevel":"info","method":"GET","requestHeaders":{"host":"localhost:62595","connection":"close"},"responseHeaders":{"date":"Sat, 30 Sep 2017 20:25:38 GMT","content-length":"7","x-forward-proxy-request-id":"2b746d92-1a8b-4f36-b3cc-5bff57dad94d","x-forward-proxy-cache-hit":"true"},"statusCode":200,"url":"http://localhost:62595/"},"message":"response","sequence":5,"time":1506803138762,"version":"1.0.0"} | ||
``` | ||
`roarr` CLI program will format the output to look like this: | ||
 | ||
* `@` prefixed value denotes the name of the package. | ||
* `#` prefixed value denotes the namespace. | ||
Explore other CLI options using `roar --help`. | ||
## Transports | ||
@@ -241,0 +275,0 @@ |
38810
41.49%20
17.65%239
39.77%343
11%6
200%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added