parent
fbe20e7ea3
commit
c3b76b1f15
1 changed files with 28 additions and 28 deletions
56
README.md
56
README.md
|
@ -491,16 +491,16 @@ Recommended/Best Practice Fields:
|
||||||
- `err`: Object. A caught JS exception. Log that thing with `log.info(err)`
|
- `err`: Object. A caught JS exception. Log that thing with `log.info(err)`
|
||||||
to get:
|
to get:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
...
|
...
|
||||||
"err": {
|
"err": {
|
||||||
"message": "boom",
|
"message": "boom",
|
||||||
"name": "TypeError",
|
"name": "TypeError",
|
||||||
"stack": "TypeError: boom\n at Object.<anonymous> ..."
|
"stack": "TypeError: boom\n at Object.<anonymous> ..."
|
||||||
},
|
},
|
||||||
"msg": "boom",
|
"msg": "boom",
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
Or use the `bunyan.stdSerializers.err` serializer in your Logger and
|
Or use the `bunyan.stdSerializers.err` serializer in your Logger and
|
||||||
do this `log.error({err: err}, "oops")`. See "examples/err.js".
|
do this `log.error({err: err}, "oops")`. See "examples/err.js".
|
||||||
|
@ -516,28 +516,28 @@ Recommended/Best Practice Fields:
|
||||||
- `req`: An HTTP server request. Bunyan provides `bunyan.stdSerializers.req`
|
- `req`: An HTTP server request. Bunyan provides `bunyan.stdSerializers.req`
|
||||||
to serialize a request with a suggested set of keys. Example:
|
to serialize a request with a suggested set of keys. Example:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "/path?q=1#anchor",
|
"url": "/path?q=1#anchor",
|
||||||
"headers": {
|
"headers": {
|
||||||
"x-hi": "Mom",
|
"x-hi": "Mom",
|
||||||
"connection": "close"
|
"connection": "close"
|
||||||
},
|
},
|
||||||
"remoteAddress": "120.0.0.1",
|
"remoteAddress": "120.0.0.1",
|
||||||
"remotePort": 51244
|
"remotePort": 51244
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- `res`: An HTTP server response. Bunyan provides `bunyan.stdSerializers.res`
|
- `res`: An HTTP server response. Bunyan provides `bunyan.stdSerializers.res`
|
||||||
to serialize a response with a suggested set of keys. Example:
|
to serialize a response with a suggested set of keys. Example:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"statusCode": 200,
|
"statusCode": 200,
|
||||||
"header": "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n"
|
"header": "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Other fields to consider:
|
Other fields to consider:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue