@autofleet/node-common 1.1.30 → 1.1.35
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 +17 -0
- package/package.json +2 -2
package/logger/index.js
CHANGED
|
@@ -19,12 +19,29 @@ const getLevel = (logLevel) => {
|
|
|
19
19
|
return 'debug';
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
const enumerateErrorFormat = winston.format((info) => {
|
|
23
|
+
if (info.message instanceof Error) {
|
|
24
|
+
info.message = Object.assign({ // eslint-disable-line
|
|
25
|
+
message: info.message.message,
|
|
26
|
+
stack: info.message.stack,
|
|
27
|
+
}, info.message);
|
|
28
|
+
}
|
|
29
|
+
if (info instanceof Error) {
|
|
30
|
+
return Object.assign({
|
|
31
|
+
message: info.message,
|
|
32
|
+
stack: info.stack,
|
|
33
|
+
}, info);
|
|
34
|
+
}
|
|
35
|
+
return info;
|
|
36
|
+
});
|
|
37
|
+
|
|
22
38
|
const getFormat = () => {
|
|
23
39
|
if (env.NODE_ENV === 'producation') {
|
|
24
40
|
return winston.format.json();
|
|
25
41
|
}
|
|
26
42
|
|
|
27
43
|
return winston.format.combine(
|
|
44
|
+
enumerateErrorFormat(),
|
|
28
45
|
winston.format.splat(),
|
|
29
46
|
winston.format.colorize(),
|
|
30
47
|
winston.format.simple(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/node-common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.35",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"coverage": "jest --coverage --forceExit --runInBand",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://gitlab.com/AutoFleet/node-common#README",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@google-cloud/logging-winston": "^0.
|
|
25
|
+
"@google-cloud/logging-winston": "^0.10.1",
|
|
26
26
|
"@google-cloud/monitoring": "^0.6.0",
|
|
27
27
|
"@google-cloud/profiler": "^0.2.0",
|
|
28
28
|
"@google-cloud/pubsub": "^0.19.0",
|