@spytecgps/lambda-utils 1.0.7 → 1.0.8
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/dist/logger/logger.js
CHANGED
|
@@ -6,19 +6,13 @@ var winston_console_format_1 = require("winston-console-format");
|
|
|
6
6
|
var combine = winston_1.format.combine, errors = winston_1.format.errors, json = winston_1.format.json, timestamp = winston_1.format.timestamp, colorize = winston_1.format.colorize, padLevels = winston_1.format.padLevels;
|
|
7
7
|
exports.isLocal = function () { return !!process.env.IS_OFFLINE; };
|
|
8
8
|
exports.isTest = function () { return process.env.NODE_ENV == 'test'; };
|
|
9
|
-
var replaceError = function (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
var replacer = function (_key, value) {
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
return value instanceof Error ? replaceError(value) : value;
|
|
21
|
-
};
|
|
9
|
+
var replaceError = function (localError) { return ({
|
|
10
|
+
label: localError.label,
|
|
11
|
+
level: localError.level,
|
|
12
|
+
message: localError.message,
|
|
13
|
+
stack: localError.stack,
|
|
14
|
+
}); };
|
|
15
|
+
var replacer = function (_key, value) { return (value instanceof Error ? replaceError(value) : value); };
|
|
22
16
|
function getDevFormat() {
|
|
23
17
|
return combine(timestamp(), colorize({ all: true }), padLevels(), winston_console_format_1.consoleFormat({
|
|
24
18
|
showMeta: true,
|
|
@@ -60,7 +60,7 @@ exports.contextualLogger = function () {
|
|
|
60
60
|
if (!ctx.requestId) {
|
|
61
61
|
ctx.requestId = (_b = event === null || event === void 0 ? void 0 : event.requestContext) === null || _b === void 0 ? void 0 : _b.requestId;
|
|
62
62
|
}
|
|
63
|
-
if (Object
|
|
63
|
+
if (Object.prototype.hasOwnProperty.call(event, 'headers')) {
|
|
64
64
|
apiEvent_1 = event;
|
|
65
65
|
Object.keys(apiEvent_1).forEach(function (header) {
|
|
66
66
|
if (header.toLowerCase().startsWith(CORRELATION_HEADER)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spytecgps/lambda-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Lambda Utils",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"build": "tsc",
|
|
13
13
|
"test": "jest",
|
|
14
14
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
15
|
-
"lint": "eslint
|
|
15
|
+
"lint": "eslint \"src/**/*.ts\"",
|
|
16
|
+
"lint-fix": "eslint \"src/**/*.ts\" --fix",
|
|
16
17
|
"version-publish": "npm version patch && npm publish"
|
|
17
18
|
},
|
|
18
19
|
"repository": {
|