Comparing version 2.8.0 to 2.9.0
@@ -15,11 +15,4 @@ { | ||
"boolean": "^0.1.3", | ||
"chalk": "^2.4.1", | ||
"optional": "^0.1.4", | ||
"prettyjson": "^1.2.1", | ||
"semver-compare": "^1.0.0", | ||
"split2": "^2.2.0", | ||
"sprintf-js": "^1.1.1", | ||
"through2": "^2.0.3", | ||
"ulid": "^2.3.0", | ||
"yargs": "^12.0.1" | ||
"sprintf-js": "^1.1.1" | ||
}, | ||
@@ -75,5 +68,2 @@ "description": "JSON logger for Node.js and browser.", | ||
}, | ||
"peerDependencies": { | ||
"node-jq": "^1.3.1" | ||
}, | ||
"repository": { | ||
@@ -89,3 +79,3 @@ "type": "git", | ||
}, | ||
"version": "2.8.0" | ||
"version": "2.9.0" | ||
} |
@@ -28,5 +28,2 @@ # Roarr | ||
* [CLI program](#cli-program) | ||
* [`augment` program](#filter-program) | ||
* [`filter` program](#filter-program) | ||
* [`pretty-print` program](#pretty-print-program) | ||
* [Transports](#transports) | ||
@@ -349,84 +346,15 @@ * [Environment variables](#environment-variables) | ||
Explore all CLI commands and options using `roarr --help`. | ||
Roarr CLI program provides ability to augment, filter and pretty-print Roarr logs. | ||
### `augment` program | ||
![CLI output demo](./.README/cli-output-demo.png) | ||
Roarr `augment` CLI program appends additional information to every log message prior to sending to the log aggregator, e.g. | ||
CLI program has been moved to a separate package [`@roarr/cli`](https://github.com/gajus/roarr-cli). | ||
```bash | ||
$ echo '{"context":{"package":"raygun","namespace":"createHttpProxyServer","logLevel":40},"message":"internal SSL Server running on 0.0.0.0:59222","sequence":0,"time":1533310067405,"version":"1.0.0"} | ||
{"context":{"package":"raygun","namespace":"createHttpProxyServer","logLevel":40},"message":"gracefully shutting down the proxy server","sequence":1,"time":1533310067438,"version":"1.0.0"} | ||
{"context":{"package":"raygun","namespace":"createOnCloseEventHandler","logLevel":30},"message":"raygun server closed","sequence":2,"time":1533310067439,"version":"1.0.0"} | ||
{"context":{"package":"raygun","namespace":"createOnCloseEventHandler","logLevel":30},"message":"internal SSL close","sequence":3,"time":1533310067439,"version":"1.0.0"}' | roarr augment --append-hostname true --append-instance-id true | ||
{"context":{"package":"raygun","namespace":"createHttpProxyServer","logLevel":40,"hostname":"curiosity.local","instanceId":"01CM07A7DGAB6YV25396FD772Q"},"message":"internal SSL Server running on 0.0.0.0:59222","sequence":0,"time":1533310067405,"version":"1.0.0"} | ||
{"context":{"package":"raygun","namespace":"createHttpProxyServer","logLevel":40,"hostname":"curiosity.local","instanceId":"01CM07A7DGAB6YV25396FD772Q"},"message":"gracefully shutting down the proxy server","sequence":1,"time":1533310067438,"version":"1.0.0"} | ||
{"context":{"package":"raygun","namespace":"createOnCloseEventHandler","logLevel":30,"hostname":"curiosity.local","instanceId":"01CM07A7DGAB6YV25396FD772Q"},"message":"raygun server closed","sequence":2,"time":1533310067439,"version":"1.0.0"} | ||
{"context":{"package":"raygun","namespace":"createOnCloseEventHandler","logLevel":30,"hostname":"curiosity.local","instanceId":"01CM07A7DGAB6YV25396FD772Q"},"message":"internal SSL close","sequence":3,"time":1533310067439,"version":"1.0.0"} | ||
``` | ||
npm install @roarr/cli -g | ||
### `filter` program | ||
[Log filtering](#filtering-logs) can be done using a JSON processor such as `jq`. However, `jq` [does make it easy to ignore invalid JSON](https://github.com/stedolan/jq/issues/1547). | ||
Roarr `filter` CLI program filters Roarr JSON messages while passing through all the other content, e.g. | ||
```bash | ||
$ echo ' | ||
{"context":{"package":"raygun","namespace":"createHttpProxyServer","logLevel":40},"message":"internal SSL Server running on 0.0.0.0:59222","sequence":0,"time":1533310067405,"version":"1.0.0"} | ||
{"context":{"package":"raygun","namespace":"createHttpProxyServer","logLevel":40},"message":"gracefully shutting down the proxy server","sequence":1,"time":1533310067438,"version":"1.0.0"} | ||
{"context":{"package":"raygun","namespace":"createOnCloseEventHandler","logLevel":30},"message":"raygun server closed","sequence":2,"time":1533310067439,"version":"1.0.0"} | ||
foo bar | ||
{"foo": "bar"} | ||
{"context":{"package":"raygun","namespace":"createOnCloseEventHandler","logLevel":30},"message":"internal SSL close","sequence":3,"time":1533310067439,"version":"1.0.0"} | ||
' | roarr filter 'select(.context.logLevel > 30)' | roarr pretty-print | ||
[2018-08-03T15:27:47.405Z] WARN (40) (@raygun) (#createHttpProxyServer): internal SSL Server running on 0.0.0.0:59222 | ||
[2018-08-03T15:27:47.438Z] WARN (40) (@raygun) (#createHttpProxyServer): gracefully shutting down the proxy server | ||
foo bar | ||
{"foo": "bar"} | ||
``` | ||
To use `roarr filter` program, you must install peer dependency `node-jq`: | ||
Explore all CLI commands and options using `roarr --help` or refer to [`@roarr/cli`](https://github.com/gajus/roarr-cli) documentation. | ||
```bash | ||
# If Roarr is installed locally: | ||
$ npm install node-jq | ||
# or, if Roarr is installed globally: | ||
$ npm install node-jq -g | ||
``` | ||
### `pretty-print` program | ||
Roarr `pretty-print` CLI program pretty-prints logs for the development purposes. | ||
To format the logs, pipe the program output to `roarr pretty-print` program, e.g. | ||
```bash | ||
$ npm install roarr -g | ||
$ ROARR_LOG=true node index.js | roarr pretty-print | ||
``` | ||
Provided that the `index.js` program produced an output such as: | ||
``` | ||
{"context":{"package":"forward-proxy","namespace":"createHttpProxyServer","logLevel":30},"message":"Internal SSL Server running on localhost:62597","sequence":0,"time":1506803138704,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createRequestProcessor","logLevel":30},"message":"request start -> http://localhost:62595/","sequence":1,"time":1506803138741,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createLogInterceptor","logLevel":20,"headers":{"host":"localhost:62595","connection":"close"}},"message":"received request","sequence":2,"time":1506803138741,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createRequestProcessor","logLevel":30},"message":"request finished <- http://localhost:62595/","sequence":3,"time":1506803138749,"version":"1.0.0"} | ||
{"context":{"package":"forward-proxy","namespace":"createLogInterceptor","logLevel":30,"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":30,"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 pretty-print` CLI program will format the output to look like this: | ||
![CLI output demo](./.README/cli-output-demo.png) | ||
* `@` prefixed value denotes the name of the package. | ||
* `#` prefixed value denotes the namespace. | ||
The `roarr pretty-print` CLI program is using the context property names suggested in the [conventions](#conventions) to pretty-print the logs for the developer inspection purposes. | ||
## Transports | ||
@@ -433,0 +361,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
52224
34
233
523
- Removedchalk@^2.4.1
- Removedoptional@^0.1.4
- Removedprettyjson@^1.2.1
- Removedsplit2@^2.2.0
- Removedthrough2@^2.0.3
- Removedulid@^2.3.0
- Removedyargs@^12.0.1
- Removed@hapi/address@2.1.4(transitive)
- Removed@hapi/formula@1.2.0(transitive)
- Removed@hapi/hoek@8.5.1(transitive)
- Removed@hapi/joi@16.1.8(transitive)
- Removed@hapi/pinpoint@1.0.2(transitive)
- Removed@hapi/topo@3.1.6(transitive)
- Removed@sindresorhus/is@0.7.0(transitive)
- Removed@types/hapi__joi@17.1.15(transitive)
- Removedansi-regex@2.1.13.0.1(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedarchive-type@4.0.0(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbin-build@3.0.0(transitive)
- Removedbl@1.2.3(transitive)
- Removedbuffer@5.7.1(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-crc32@0.2.13(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedcacheable-request@2.1.4(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcaw@2.0.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcliui@4.1.0(transitive)
- Removedclone-response@1.0.2(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcolors@1.4.0(transitive)
- Removedcommander@2.20.3(transitive)
- Removedconfig-chain@1.1.13(transitive)
- Removedcontent-disposition@0.5.4(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcross-spawn@5.1.06.0.5(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddecompress@4.2.1(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removeddecompress-tar@4.1.1(transitive)
- Removeddecompress-tarbz2@4.1.1(transitive)
- Removeddecompress-targz@4.1.1(transitive)
- Removeddecompress-unzip@4.0.1(transitive)
- Removeddownload@6.2.58.0.0(transitive)
- Removedduplexer3@0.1.5(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedexeca@0.7.01.0.0(transitive)
- Removedext-list@2.2.2(transitive)
- Removedext-name@5.0.0(transitive)
- Removedfd-slicer@1.1.0(transitive)
- Removedfile-type@11.1.03.9.04.4.05.2.06.2.0(transitive)
- Removedfilename-reserved-regex@2.0.0(transitive)
- Removedfilenamify@2.1.03.0.0(transitive)
- Removedfind-up@3.0.0(transitive)
- Removedfrom2@2.3.0(transitive)
- Removedfs-constants@1.0.0(transitive)
- Removedget-caller-file@1.0.3(transitive)
- Removedget-proxy@2.1.0(transitive)
- Removedget-stream@2.3.13.0.04.1.0(transitive)
- Removedgot@7.1.08.3.2(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedhas-symbol-support-x@1.4.2(transitive)
- Removedhas-to-string-tag-x@1.4.1(transitive)
- Removedhttp-cache-semantics@3.8.1(transitive)
- Removedieee754@1.2.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedini@1.3.8(transitive)
- Removedinto-stream@3.1.0(transitive)
- Removedinvert-kv@2.0.0(transitive)
- Removedis-extglob@1.0.0(transitive)
- Removedis-fullwidth-code-point@1.0.02.0.0(transitive)
- Removedis-glob@2.0.1(transitive)
- Removedis-invalid-path@0.1.0(transitive)
- Removedis-natural-number@4.0.1(transitive)
- Removedis-object@1.0.2(transitive)
- Removedis-plain-obj@1.1.0(transitive)
- Removedis-retry-allowed@1.2.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedis-valid-path@0.1.1(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedisurl@1.0.0(transitive)
- Removedjson-buffer@3.0.0(transitive)
- Removedkeyv@3.0.0(transitive)
- Removedlcid@2.0.0(transitive)
- Removedlocate-path@3.0.0(transitive)
- Removedlowercase-keys@1.0.01.0.1(transitive)
- Removedlru-cache@4.1.5(transitive)
- Removedmake-dir@1.3.02.1.0(transitive)
- Removedmap-age-cleaner@0.1.3(transitive)
- Removedmem@4.3.0(transitive)
- Removedmime-db@1.53.0(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removednice-try@1.0.5(transitive)
- Removednode-jq@1.12.0(transitive)
- Removednormalize-url@2.0.1(transitive)
- Removednpm-conf@1.1.3(transitive)
- Removednpm-run-path@2.0.2(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedoptional@0.1.4(transitive)
- Removedos-locale@3.1.0(transitive)
- Removedp-cancelable@0.3.00.4.1(transitive)
- Removedp-defer@1.0.0(transitive)
- Removedp-event@1.3.02.3.1(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-is-promise@1.1.02.1.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@3.0.0(transitive)
- Removedp-map-series@1.0.0(transitive)
- Removedp-reduce@1.0.0(transitive)
- Removedp-timeout@1.2.12.0.1(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedpend@1.2.0(transitive)
- Removedpify@2.3.03.0.04.0.1(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedprepend-http@1.0.42.0.0(transitive)
- Removedprettyjson@1.2.5(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedproto-list@1.2.4(transitive)
- Removedpseudomap@1.0.2(transitive)
- Removedpump@3.0.2(transitive)
- Removedquery-string@5.1.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedrequire-main-filename@1.0.1(transitive)
- Removedresponselike@1.0.2(transitive)
- Removedsafe-buffer@5.1.25.2.1(transitive)
- Removedseek-bzip@1.0.6(transitive)
- Removedsemver@5.7.2(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedsort-keys@1.1.22.0.0(transitive)
- Removedsort-keys-length@1.0.1(transitive)
- Removedsplit2@2.2.0(transitive)
- Removedstrict-uri-encode@1.1.0(transitive)
- Removedstring-width@1.0.22.1.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@3.0.14.0.0(transitive)
- Removedstrip-dirs@2.1.0(transitive)
- Removedstrip-eof@1.0.0(transitive)
- Removedstrip-final-newline@2.0.0(transitive)
- Removedstrip-outer@1.0.1(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedtemp-dir@1.0.02.0.0(transitive)
- Removedtempfile@2.0.03.0.0(transitive)
- Removedthrough@2.3.8(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedtimed-out@4.0.1(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedtrim-repeated@1.0.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedulid@2.3.0(transitive)
- Removedunbzip2-stream@1.4.3(transitive)
- Removedurl-parse-lax@1.0.03.0.0(transitive)
- Removedurl-to-options@1.0.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@3.4.0(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwrap-ansi@2.1.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyallist@2.1.2(transitive)
- Removedyargs@12.0.5(transitive)
- Removedyargs-parser@11.1.1(transitive)
- Removedyauzl@2.10.0(transitive)