microservice-chain-logger
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "microservice-chain-logger", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "JSON logger for microservices with bundled Correlation ID and http-server access logging", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,3 +11,3 @@ [![build status](https://travis-ci.org/jochen-schweizer/microservice-chain-logger.png)](https://travis-ci.org/jochen-schweizer/microservice-chain-logger) [![Coverage Status](https://coveralls.io/repos/github/jochen-schweizer/microservice-chain-logger/badge.svg?branch=master)](https://coveralls.io/github/jochen-schweizer/microservice-chain-logger?branch=master) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://www.tldrlegal.com/l/mit) [![NPM version](https://badge.fury.io/js/microservice-chain-logger.png)](http://badge.fury.io/js/microservice-chain-logger) | ||
* wrappers for `console.info/warn/error` producing a text or JSON inflated with customizable metadata | ||
* access log express middleware for providing metadata through the same API | ||
* access log express middleware with additional metadata provided with the same API | ||
* reading/assigning `X-Correlation-ID` which is automatically reflected in the log messages (including access logs) | ||
@@ -85,3 +85,3 @@ | ||
Not **logger.info()** uses the same **console.info()** just like **logger.info()** | ||
Note: **logger.debug()** uses the same **console.info()** just like **logger.info()** | ||
@@ -108,6 +108,2 @@ ### logger.infoSource() | ||
The access log middleware adds a field `isAccessLog` to the log | ||
entry, which is then removed in the default `transformEntry`. | ||
You can use this flag for special logic for messages coming from access log. | ||
```javascript | ||
@@ -131,4 +127,4 @@ // access log will not be triggered for /status | ||
```javascript | ||
// init access log and replace transformEntry, | ||
// so that it produces text logs instead of JSON when in dev. mode | ||
// init access log and replace transformEntry | ||
// so that it produces JSON when in production environment | ||
app.use(logger.initAccessLog({ | ||
@@ -139,2 +135,6 @@ useJsonTransformer: process.env.NODE_ENV === 'production' | ||
The access log middleware adds a field `isAccessLog` to the log | ||
entry, which is then removed in the default `transformEntry`. | ||
You can use this flag for special logic for messages coming from access log. | ||
### logger.getCorrelationId(req) | ||
@@ -166,3 +166,3 @@ | ||
For most of the cases you should be fine with functions above, | ||
For the most of the cases you should be fine with the functions above, | ||
but feel free to hack the library at your on risk. | ||
@@ -271,3 +271,3 @@ | ||
{ | ||
"useTextTransformer": true | ||
"useJsonTransformer": true | ||
} | ||
@@ -280,4 +280,4 @@ ] | ||
``` | ||
... you may want to move the `arguments` part to `development.json`, | ||
so that in production you get JSON. | ||
... you may want to move the `arguments` part to `production.json`, | ||
so that you get JSON in production environment only. | ||
@@ -284,0 +284,0 @@ ### More examles |
16208