Skip to content

Commit 37dae09

Browse files
committedFeb 8, 2017
Add section about Error Reporting configuration to README
1 parent ed9c91b commit 37dae09

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
 

‎README.md

+18
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,24 @@ limit is 20 RPS. The default setting for BunyanStackDriver is 500 ms.)
7474

7575
* errorCallback. Will report errors during the logging process itself.
7676

77+
## Stackdriver Error Reporting
78+
79+
When errors with stack traces are logged - `bunyan.error(new Error('message'))` - these can automatically be captured by the [Error Reporting](https://cloud.google.com/error-reporting/) interface in Google Cloud Platform. To do so some additional configuration is required as per [Stackdriver Formatting Error Messages](https://cloud.google.com/error-reporting/docs/formatting-error-messages)
80+
81+
When logging, a _service context_ is required. This can be added on a per log basis or configured for all logs during logger creation like so:
82+
83+
```
84+
const logger = bunyan.createLogger({
85+
name: 'Example',
86+
serializers: ...
87+
streams: ...,
88+
serviceContext: {
89+
service: 'example',
90+
version: 'x.x.x'
91+
}
92+
});
93+
```
94+
7795
## Links
7896

7997
[Stackdriver Logging - Method entries.write](https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/entries/write)

0 commit comments

Comments
 (0)
Failed to load comments.