Skip to content

Commit

Permalink
docs: document usage of silent spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 27, 2023
1 parent c48fa6c commit 929454b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,25 @@ loader.update('unpacking packages', { suffix: undefined })
loader.stop()
```

### Spinner in silent mode
If you writing conditionals around the spinning animation to start it in certain conditions, then you might want to create the spinner in silent mode. In silent mode, the spinner will not output any logs.

```ts
const loader = logger.await('installing packages', {
suffix: 'npm i',
silent: true // 👈
})

// Prints nothing
loader.start()

// Prints nothing
loader.update('unpacking packages', { suffix: undefined })

// Prints nothing
loader.stop()
```

### Preparing messages without writing them
You can also use the logger to just prepare the message (with colors and formatting) without writing it to the output stream. Just prefix the log message with `prepare` and it will return a string value.

Expand Down

0 comments on commit 929454b

Please sign in to comment.