Skip to content

Commit 91ec069

Browse files
AlejandroFabianCamposwbt
authored andcommittedNov 8, 2023
chore(README.md): adds documentation around coloring json formatted logs
1 parent c3c3911 commit 91ec069

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed
 

‎README.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -675,10 +675,21 @@ To colorize the standard logging level add
675675
```js
676676
winston.format.combine(
677677
winston.format.colorize(),
678-
winston.format.json()
678+
winston.format.simple()
679+
);
680+
```
681+
where `winston.format.simple()` is whatever other formatter you want to use. The `colorize` formatter must come before any formatters adding text you wish to color.
682+
683+
### Colorizing full log line when json formatting logs
684+
685+
To colorize the full log line with the json formatter you can apply the following
686+
687+
```js
688+
winston.format.combine(
689+
winston.format.json(),
690+
winston.format.colorize({ all })
679691
);
680692
```
681-
where `winston.format.json()` is whatever other formatter you want to use. The `colorize` formatter must come before any formatters adding text you wish to color.
682693

683694
## Transports
684695

0 commit comments

Comments
 (0)
Please sign in to comment.