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

Commit fa43019

Browse files
author
Michal Vlasák
committed
Update version, add option for stackdriver settings
1 parent 3f2ca10 commit fa43019

5 files changed

Lines changed: 20 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [0.2.5] - 2018-09-10
2+
3+
### Added
4+
- log object are automatically enhanced for Google Stackdriver
5+
- `options.disableStackdriverFormat` to prevent logger from modifying log objects
6+
17
## [0.2.4] - 2018-09-06
28

39
### Added

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Options override both default logger configuration and environment-specific conf
100100
- `ignoredHttpMethods` - list of HTTP methods which will not be logged by express logging middleware at all. Defaults to `['OPTIONS']`
101101
- `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
102102
- `pretty` - if set to `true`, logger will use [pino pretty human-readable logs](https://github.com/pinojs/pino/blob/master/docs/API.md#pretty). This option can be overriden by `streams`
103+
- `disableStackdriverFormat` - if set to `true`, logger will add `severity` field to all log objects, so that log levels in Google Stackdriver work as expected
103104
- `config` - object, which will be passed to underlying logger object. Right now, underlying logger is [pino](https://github.com/pinojs/pino), so for available options see [pino API docs](https://github.com/pinojs/pino/blob/master/docs/API.md#pinooptions-stream)
104105

105106
## Default serializers

index.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ const defaultLogger = (options = {}) => {
6969
{ level: levels.warn, stream: process.stderr },
7070
];
7171
}
72-
streams = streams.map(stream => {
73-
const newStream = new StackDriverFormatStream();
74-
newStream.pipe(stream.stream);
75-
return {
76-
level: stream.level,
77-
maxLevel: stream.maxLevel,
78-
stream: newStream,
79-
};
80-
});
72+
if (!_.get(options, 'disableStackdriverFormat', false)) {
73+
streams = streams.map(stream => {
74+
const newStream = new StackDriverFormatStream();
75+
newStream.pipe(stream.stream);
76+
return {
77+
level: stream.level,
78+
maxLevel: stream.maxLevel,
79+
stream: newStream,
80+
};
81+
});
82+
}
8183

8284
if (!options.ignoredHttpMethods) {
8385
options.ignoredHttpMethods = ['OPTIONS'];

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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.2.4",
3+
"version": "0.2.5",
44
"description": "Ackee Node Logger",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)