Skip to content

Commit

Permalink
docs: add CLI configuration documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Dec 12, 2018
1 parent 14d259a commit 6eb6dc0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@ $ echo '{"context":{"package":"raygun","namespace":"createHttpProxyServer","logL
{"context":{"package":"raygun","namespace":"createOnCloseEventHandler","logLevel":30,"hostname":"curiosity.local","instanceId":"01CM07A7DGAB6YV25396FD772Q"},"message":"internal SSL close","sequence":3,"time":1533310067439,"version":"1.0.0"}
```

#### `augment` configuration

|Name|Description|Default|
|---|---|---|
|`append-hostname`|Includes a hostname.|`true`|
|`append-instance-id`|Generates and includes a unique instance ID.|`true`|
|`exclude-orphans`|Excludes messages that cannot be recognized as Roarr log message.|`false`|

### `filter` program

Log filtering 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.
Roarr `filter` CLI program filters Roarr JSON messages while (optionally) passing through all the other content, e.g.

```bash
$ echo '
Expand All @@ -62,6 +70,13 @@ foo bar

```
#### `filter` configuration
|Name|Description|Default|
|---|---|---|
|`context`|Print a number of lines leading and trailing context surrounding each match.|2|
|`exclude-orphans`|Excludes messages that cannot be recognized as Roarr log message.|`false`|
### `pretty-print` program
Roarr `pretty-print` CLI program pretty-prints logs for the development purposes.
Expand Down Expand Up @@ -93,3 +108,11 @@ Provided that the `index.js` program produced an output such as:
* `#` 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.

#### `pretty-print` configuration

|Name|Description|Default|
|---|---|---|
|`context`|Print a number of lines leading and trailing context surrounding each match.|2|
|`exclude-orphans`|Excludes messages that cannot be recognized as Roarr log message.|`false`|
|`include-context`|Includes message context payload.|`true`|
2 changes: 2 additions & 0 deletions src/bin/commands/augment.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ export const builder = (yargs: Object) => {
.options({
'append-hostname': {
default: false,
description: 'Includes a hostname.',
type: 'boolean'
},
'append-instance-id': {
default: false,
description: 'Generates and includes a unique instance ID.',
type: 'boolean'
},
'exclude-orphans': {
Expand Down
1 change: 1 addition & 0 deletions src/bin/commands/pretty-print.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export const builder = (yargs: Object) => {
},
'include-context': {
default: true,
description: 'Includes message context payload.',
type: 'boolean'
}
});
Expand Down

0 comments on commit 6eb6dc0

Please sign in to comment.