Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 2efd23d

Browse files
author
Michal Vlasák
committed
Add options.pino
1 parent 7cb2a80 commit 2efd23d

3 files changed

Lines changed: 43 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [0.2.1] - 2018-06-08
2+
3+
### Added
4+
5+
- `options.pino` for configuring underlying pino instance
6+
- "Tips" section to README
7+
8+
19
## [0.1.1] - 2018-05-29
210

311
### Added

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Options override both default logger configuration and environment-specific conf
102102
- `enableFields` - list of paths which will not be omitted by default serializers from objects being logged
103103
- `streams` - list of stream objects, which will be passed directly to [pino-multistream's multistream function](https://github.com/pinojs/pino-multi-stream#pinomsmultistreamstreams) instead of default `ackee-node-logger` stream
104104
- `pretty` - if set to `true`, logger will use pretty print. This option can be overriden by `streams`
105+
- `pino` - object, which will be passed to underlying pino logger. See available settings in [pino API docs](https://github.com/pinojs/pino/blob/master/docs/API.md#pinooptions-stream)
105106

106107
## Default serializers
107108
`ackee-node-logger` defines some [pino serializers](https://github.com/pinojs/pino/blob/master/docs/API.md#constructor) on its own
@@ -110,3 +111,36 @@ Options override both default logger configuration and environment-specific conf
110111
- `processEnv` - logs `NODE_PATH` and `NODE_ENV`
111112
- `req` - logs `body`, `query`, `url`, `method` and omits `password` and `passwordCheck` from `body` and `query`
112113
- `res` - logs `out` and `time`
114+
115+
116+
## Tips
117+
118+
### Nice Google Cloud Stackdriver messages
119+
120+
If you examine log messages in Google's [Stackdriver](https://cloud.google.com/stackdriver/) you probably noticed that most of the time, the whole message payload is displayed as a "title" of the message.
121+
122+
This is because Stackdriver takes the title from `message` field (if available). But pino (ackee-node-logger underlying library) logs those titles to `msg` field (by default).
123+
124+
This can be changed by passing pino the `messageKey` option. It will hide the pretty print message title, but you will have nicer Stackdriver messages
125+
126+
```js
127+
const logger = require('ackee-node-logger')({ pino: { messageKey: 'message'} });
128+
```
129+
130+
### VS Code debugging not showing log messages
131+
132+
This problem is caused by a way VS Code handles console output. Therefore it appears in Winston and pino (underlying library of ackee-node-logger) as well.
133+
134+
However, it can be easily solved by adding eithe
135+
136+
```js
137+
"console": "integratedTerminal",
138+
```
139+
140+
or
141+
142+
```js
143+
"outputCapture": "std"
144+
```
145+
146+
to the debug configuration in your `launch.json` file.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ackee-node-logger",
3-
"version": "0.1.1",
3+
"version": "0.2.1",
44
"description": "Ackee Node Logger",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)