@autofleet/node-common 1.1.30 → 1.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/logger/index.js +4 -1
- package/network/index.js +8 -4
- package/package.json +2 -2
package/logger/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
const winston = require('winston');
|
|
2
|
+
const { LoggingWinston } = require('@google-cloud/logging-winston');
|
|
3
|
+
|
|
4
|
+
const loggingWinston = new LoggingWinston();
|
|
2
5
|
|
|
3
6
|
const { createLogger } = winston;
|
|
4
7
|
require('dotenv').config();
|
|
@@ -35,7 +38,7 @@ const createLoggerInstance = (level, transports) => {
|
|
|
35
38
|
const logger = createLogger({
|
|
36
39
|
level,
|
|
37
40
|
format: getFormat(),
|
|
38
|
-
transports: [new winston.transports.Console()],
|
|
41
|
+
transports: [new winston.transports.Console(), loggingWinston],
|
|
39
42
|
exceptionHandlers: transports,
|
|
40
43
|
exitOnError: false,
|
|
41
44
|
});
|
package/network/index.js
CHANGED
|
@@ -51,9 +51,9 @@ module.exports = class Network {
|
|
|
51
51
|
const logger = Logger();
|
|
52
52
|
this.axios.interceptors.request.use((request) => {
|
|
53
53
|
logger.info(`Start Request: [${request.method.toUpperCase()}] ${request.baseURL} ${request.url}`, {
|
|
54
|
+
query: request.params,
|
|
55
|
+
body: request.data,
|
|
54
56
|
headers: request.headers,
|
|
55
|
-
query: request.query,
|
|
56
|
-
body: request.body,
|
|
57
57
|
});
|
|
58
58
|
return request;
|
|
59
59
|
});
|
|
@@ -62,8 +62,12 @@ module.exports = class Network {
|
|
|
62
62
|
logger.info(`Finish Request: [${response.config.method.toUpperCase()} ${response.config.url}`);
|
|
63
63
|
return response;
|
|
64
64
|
}, (error) => {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
if (error && error.response && error.response.data) {
|
|
66
|
+
logger.error(`Finish Request with error: ${error.response.data.message}`);
|
|
67
|
+
} else {
|
|
68
|
+
logger.error(`Finish Request with error: ${error}`);
|
|
69
|
+
}
|
|
70
|
+
// throw error; // TODO: think about that.. for its break the vehiclems tests
|
|
67
71
|
});
|
|
68
72
|
}
|
|
69
73
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/node-common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"coverage": "jest --coverage --forceExit --runInBand",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://gitlab.com/AutoFleet/node-common#README",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@google-cloud/logging-winston": "^0.9.0",
|
|
26
25
|
"@google-cloud/monitoring": "^0.6.0",
|
|
27
26
|
"@google-cloud/profiler": "^0.2.0",
|
|
27
|
+
"@google-cloud/logging-winston": "^0.9.1",
|
|
28
28
|
"@google-cloud/pubsub": "^0.19.0",
|
|
29
29
|
"axios": "^0.18.0",
|
|
30
30
|
"axios-retry": "^3.1.0",
|