Skip to content

Commit a67de6a

Browse files
committed
chore: improve readme and cli
1 parent d18de93 commit a67de6a

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ You could probably get something pretty similar with just an advanced pino-prett
4646
### Install
4747

4848
`npm install pino-princess --save-dev`
49-
or
50-
`yarn install -D pino-princess`
5149

5250
## Usage
5351

5452
### CLI
5553

56-
The reccomended usage of pino-princess is as a separate process from your main application which pipes pino logs from stdout into pino-princess for formatting.
54+
The recommended usage of pino-princess is as a separate process from your main application which pipes pino logs from stdout into pino-princess for formatting.
5755

5856
**Basic usage:**
5957

@@ -73,7 +71,7 @@ node my-application-which-logs-with-pino.js | npx pino-princess
7371
| `--timeFormat` | | string | Time format string passed to [date-fns format](https://date-fns.org/docs/format). | `'h:mm:ss.SSS aaa'` |
7472
| `--singleLine` | | boolean | Format the entire log output as a single line with no newlines. | `false` |
7573
| `--unicode` | | boolean | Force unicode emoji support on or off. Auto-detected by default. | auto-detect |
76-
| `--colors` | | boolean | Disable all color. Auto-detected by default. | `true` |
74+
| `--colors` | | boolean | Enable or disable colored output. Auto-detected by default. | auto-detect |
7775

7876
**Examples:**
7977

@@ -97,7 +95,7 @@ node app.js | pino-princess --timeFormat "yyyy-MM-dd HH:mm:ss"
9795
node app.js | pino-princess --singleLine
9896

9997
# Force unicode off for CI environments
100-
node app.js | pino-princess --unicode false
98+
node app.js | pino-princess --no-unicode
10199

102100
# Disable colors for plain text output
103101
node app.js | pino-princess --no-colors
@@ -115,7 +113,7 @@ pino-princess, as a fork of pino-pretty, is also set up to be used as a pino v7
115113

116114
## Configuration
117115

118-
pino-princess supports a simple configuration which can be supplied as either command line arguments, or alternatively, pino-princess.config.js file located in the path up from where the application is being ran.
116+
pino-princess supports a simple configuration which can be supplied as either command line arguments, or alternatively, a pino-princess.config.js file. The config file is automatically discovered by searching up from the current working directory to your home directory.
119117

120118
### example
121119

@@ -134,7 +132,7 @@ module.exports = {
134132
* In this way, excludes can be used to exclude large base objects and the "include"
135133
* can be used to pick certain fields and "add them back" to the log output.
136134
* For example, by default, pino-princess excludes the entire req or res object from any http logger.
137-
* Because some fields on req and res are required to constuct the core of the log line, these fields are added back via the include.
135+
* Because some fields on req and res are required to construct the core of the log line, these fields are added back via the include.
138136
*
139137
* default value:
140138
*/
@@ -146,7 +144,7 @@ module.exports = {
146144
*
147145
* An array of strings which represent a key on any object.
148146
* Keys matching any one of these strings cause these keys will ensure the key is always part of the log output.
149-
* The includes always overrides by the excludes.
147+
* The includes always override the excludes.
150148
* In this way, include can be used to "add back" properties of excluded objects to the log output.
151149
* By default pino-princess includes all the properties required to create our standard log line.
152150
*
@@ -259,7 +257,7 @@ module.exports = {
259257
keyMap: {},
260258
/**
261259
* theme
262-
* (chalk: Chalk) => string
260+
* (chalk: Chalk) => object
263261
*
264262
* This determines the colors of any extra fields that are not included in the pino-princess log line
265263
*

cli.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ Options
2222
--timeKey key for the time field, defaults to 'time'
2323
--timeFormat format for the time field, passed to date-fns format defaults to 'h:mm:ss.SSS aaa'
2424
--singleLine format the output as a single line, defaults to false
25-
--unicode force unicode emojis on or off, auto-detected by default
26-
--colors enable or disable all color output, auto-detected by default
25+
--unicode force unicode emojis on, auto-detected by default
26+
--no-unicode force unicode emojis off
27+
--colors enable all color output, auto-detected by default
28+
--no-colors disable all color output
2729
`;
2830

2931
const cli = util.parseArgs({

test/snapshots/cli.test.ts.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Generated by [AVA](https://avajs.dev).
2222
--timeKey key for the time field, defaults to 'time'␊
2323
--timeFormat format for the time field, passed to date-fns format defaults to 'h:mm:ss.SSS aaa'␊
2424
--singleLine format the output as a single line, defaults to false␊
25-
--unicode force unicode emojis on or off, auto-detected by default␊
26-
--colors enable or disable all color output, auto-detected by default␊
25+
--unicode force unicode emojis on, auto-detected by default␊
26+
--no-unicode force unicode emojis off␊
27+
--colors enable all color output, auto-detected by default␊
28+
--no-colors disable all color output␊
2729
`

test/snapshots/cli.test.ts.snap

11 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)