@crimson-education/browser-logger 2.0.2 → 3.0.0
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/README.md +212 -67
- package/lib/index.d.ts +6 -76
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +42 -186
- package/lib/index.js.map +1 -1
- package/lib/logger/consoleTransport.d.ts +37 -0
- package/lib/logger/consoleTransport.d.ts.map +1 -0
- package/lib/logger/consoleTransport.js +81 -0
- package/lib/logger/consoleTransport.js.map +1 -0
- package/lib/logger/datadogTransport.d.ts +8 -0
- package/lib/logger/datadogTransport.d.ts.map +1 -0
- package/lib/logger/datadogTransport.js +21 -0
- package/lib/logger/datadogTransport.js.map +1 -0
- package/lib/logger/index.d.ts +16 -0
- package/lib/logger/index.d.ts.map +1 -0
- package/lib/logger/index.js +148 -0
- package/lib/logger/index.js.map +1 -0
- package/lib/logger/index.test.d.ts +2 -0
- package/lib/logger/index.test.d.ts.map +1 -0
- package/lib/logger/index.test.js +60 -0
- package/lib/logger/index.test.js.map +1 -0
- package/lib/logger/utils.d.ts +15 -0
- package/lib/logger/utils.d.ts.map +1 -0
- package/lib/logger/utils.js +32 -0
- package/lib/logger/utils.js.map +1 -0
- package/lib/reporters/amplifyReporter.d.ts +2 -2
- package/lib/reporters/amplifyReporter.d.ts.map +1 -1
- package/lib/reporters/amplifyReporter.js +13 -14
- package/lib/reporters/amplifyReporter.js.map +1 -1
- package/lib/reporters/datadogReporter.d.ts +7 -5
- package/lib/reporters/datadogReporter.d.ts.map +1 -1
- package/lib/reporters/datadogReporter.js +37 -100
- package/lib/reporters/datadogReporter.js.map +1 -1
- package/lib/reporters/gtmReporter.d.ts.map +1 -1
- package/lib/reporters/gtmReporter.js +2 -7
- package/lib/reporters/gtmReporter.js.map +1 -1
- package/lib/reporters/index.d.ts +66 -3
- package/lib/reporters/index.d.ts.map +1 -1
- package/lib/reporters/index.js +210 -17
- package/lib/reporters/index.js.map +1 -1
- package/lib/reporters/logReporter.d.ts +35 -0
- package/lib/reporters/logReporter.d.ts.map +1 -0
- package/lib/reporters/logReporter.js +62 -0
- package/lib/reporters/logReporter.js.map +1 -0
- package/lib/types/logger.d.ts +43 -2
- package/lib/types/logger.d.ts.map +1 -1
- package/lib/types/logger.js.map +1 -1
- package/lib/types/reporter.d.ts +58 -6
- package/lib/types/reporter.d.ts.map +1 -1
- package/lib/utils.d.ts +9 -8
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +28 -48
- package/lib/utils.js.map +1 -1
- package/lib/utils.test.js +18 -5
- package/lib/utils.test.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +38 -208
- package/src/logger/consoleTransport.ts +101 -0
- package/src/logger/datadogTransport.ts +20 -0
- package/src/logger/index.test.ts +68 -0
- package/src/logger/index.ts +139 -0
- package/src/logger/utils.ts +28 -0
- package/src/reporters/amplifyReporter.ts +15 -16
- package/src/reporters/datadogReporter.ts +48 -116
- package/src/reporters/gtmReporter.ts +2 -7
- package/src/reporters/index.ts +216 -3
- package/src/reporters/logReporter.ts +86 -0
- package/src/types/logger.ts +49 -4
- package/src/types/reporter.ts +66 -6
- package/src/utils.test.ts +20 -6
- package/src/utils.ts +37 -62
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qCAAuC;AACvC,2CAAoE;AACpE,yDAAsD;AACtD,iEAA8D;AAC9D,iEAA8D;AAC9D,yDAAsD;AAEtD,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AAIzB,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;;GAGG;AACH,SAAgB,IAAI,CAAC,MAAoB;;IACvC,8DAA8D;IAC9D,IAAI,WAAW,EAA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A,oBAAW,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;KAC9B;IAED,6CAA6C;IAC7C,IAAI,MAAM,CAAC,UAAU,EAAE;QACrB,IAAA,yBAAa,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KAClC;IAED,IAAA,uBAAW,EAAC,eAAe,CAAC,CAAC;AAC/B,CAAC;AA3CD,oBA2CC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ILogTransport, LogLevel, LogTransportConfigBase } from '../types';
|
|
2
|
+
declare const colors: {
|
|
3
|
+
bold: number[];
|
|
4
|
+
italic: number[];
|
|
5
|
+
underline: number[];
|
|
6
|
+
inverse: number[];
|
|
7
|
+
white: number[];
|
|
8
|
+
grey: number[];
|
|
9
|
+
black: number[];
|
|
10
|
+
blue: number[];
|
|
11
|
+
cyan: number[];
|
|
12
|
+
green: number[];
|
|
13
|
+
magenta: number[];
|
|
14
|
+
red: number[];
|
|
15
|
+
yellow: number[];
|
|
16
|
+
};
|
|
17
|
+
export declare type ColorizeColor = keyof typeof colors;
|
|
18
|
+
/**
|
|
19
|
+
* Colorize a string with a specified color.
|
|
20
|
+
* @param str String to colorize
|
|
21
|
+
* @param color Color to colorize the string with
|
|
22
|
+
* @returns Colorized string
|
|
23
|
+
*/
|
|
24
|
+
export declare function colorize(str: string, color: ColorizeColor): string;
|
|
25
|
+
export interface ConsoleLogTransportConfig extends LogTransportConfigBase {
|
|
26
|
+
/**
|
|
27
|
+
* Add colors to log messages.
|
|
28
|
+
*/
|
|
29
|
+
colorize?: false | typeof colorize;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the color for the log level.
|
|
32
|
+
*/
|
|
33
|
+
getLogLevelColor?: (level: LogLevel) => ColorizeColor;
|
|
34
|
+
}
|
|
35
|
+
export declare function consoleTransport(config?: ConsoleLogTransportConfig): ILogTransport & ConsoleLogTransportConfig;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=consoleTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consoleTransport.d.ts","sourceRoot":"","sources":["../../src/logger/consoleTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG3E,QAAA,MAAM,MAAM;;;;;;;;;;;;;;CAcX,CAAC;AACF,oBAAY,aAAa,GAAG,MAAM,OAAO,MAAM,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,UAGzD;AAWD,MAAM,WAAW,yBAA0B,SAAQ,sBAAsB;IACvE;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,OAAO,QAAQ,CAAC;IAEnC;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,aAAa,CAAC;CACvD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,yBAA8B,6CAgDtE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.consoleTransport = exports.colorize = void 0;
|
|
4
|
+
// from browser-util-inspect
|
|
5
|
+
const colors = {
|
|
6
|
+
bold: [1, 22],
|
|
7
|
+
italic: [3, 23],
|
|
8
|
+
underline: [4, 24],
|
|
9
|
+
inverse: [7, 27],
|
|
10
|
+
white: [37, 39],
|
|
11
|
+
grey: [90, 39],
|
|
12
|
+
black: [30, 39],
|
|
13
|
+
blue: [34, 39],
|
|
14
|
+
cyan: [36, 39],
|
|
15
|
+
green: [32, 39],
|
|
16
|
+
magenta: [35, 39],
|
|
17
|
+
red: [31, 39],
|
|
18
|
+
yellow: [33, 39],
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Colorize a string with a specified color.
|
|
22
|
+
* @param str String to colorize
|
|
23
|
+
* @param color Color to colorize the string with
|
|
24
|
+
* @returns Colorized string
|
|
25
|
+
*/
|
|
26
|
+
function colorize(str, color) {
|
|
27
|
+
const colorData = colors[color];
|
|
28
|
+
return '\u001b[' + colorData[0] + 'm' + str + '\u001b[' + colorData[1] + 'm';
|
|
29
|
+
}
|
|
30
|
+
exports.colorize = colorize;
|
|
31
|
+
/**
|
|
32
|
+
* Gets a stack trace from metadata or accompanying error.
|
|
33
|
+
*/
|
|
34
|
+
function getStackTrace(data) {
|
|
35
|
+
var _a;
|
|
36
|
+
const stack = ((_a = data === null || data === void 0 ? void 0 : data.err) === null || _a === void 0 ? void 0 : _a.stack) || data.stack || data['error.stack'];
|
|
37
|
+
delete data.stack;
|
|
38
|
+
return stack !== null && stack !== void 0 ? stack : '';
|
|
39
|
+
}
|
|
40
|
+
function consoleTransport(config = {}) {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
// Default ignore patterns
|
|
43
|
+
(_a = config.ignoreMetadataPatterns) !== null && _a !== void 0 ? _a : (config.ignoreMetadataPatterns = ['application', 'service', 'environment', 'version']);
|
|
44
|
+
// Get the colorizer function, or a no-op if not enabled.
|
|
45
|
+
const colorizer = config.colorize !== false ? (_b = config.colorize) !== null && _b !== void 0 ? _b : colorize : (str) => str;
|
|
46
|
+
// Get the log level color function, or use the default colors.
|
|
47
|
+
const getLogLevelColor = (_c = config.getLogLevelColor) !== null && _c !== void 0 ? _c : ((level) => {
|
|
48
|
+
return {
|
|
49
|
+
error: 'red',
|
|
50
|
+
warn: 'yellow',
|
|
51
|
+
info: 'cyan',
|
|
52
|
+
debug: 'green',
|
|
53
|
+
}[level];
|
|
54
|
+
});
|
|
55
|
+
const transport = {
|
|
56
|
+
...config,
|
|
57
|
+
log: ({ level, message, timestamp, splat, ...metadata }) => {
|
|
58
|
+
let splatData = splat !== null && splat !== void 0 ? splat : [];
|
|
59
|
+
const stackTrace = getStackTrace(metadata);
|
|
60
|
+
const strippedInfo = { ...metadata };
|
|
61
|
+
delete strippedInfo['level'];
|
|
62
|
+
delete strippedInfo['message'];
|
|
63
|
+
delete strippedInfo['splat'];
|
|
64
|
+
delete strippedInfo['timestamp'];
|
|
65
|
+
delete strippedInfo['stack'];
|
|
66
|
+
if (Object.keys(strippedInfo).length > 0) {
|
|
67
|
+
splatData = [strippedInfo, ...splatData];
|
|
68
|
+
}
|
|
69
|
+
if (message) {
|
|
70
|
+
splatData = [message, ...splatData];
|
|
71
|
+
}
|
|
72
|
+
if (stackTrace) {
|
|
73
|
+
splatData = [...splatData, stackTrace];
|
|
74
|
+
}
|
|
75
|
+
console.log(`${colorizer(timestamp, 'magenta')} ${colorizer(level, getLogLevelColor(level))}: `, ...splatData);
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
return transport;
|
|
79
|
+
}
|
|
80
|
+
exports.consoleTransport = consoleTransport;
|
|
81
|
+
//# sourceMappingURL=consoleTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consoleTransport.js","sourceRoot":"","sources":["../../src/logger/consoleTransport.ts"],"names":[],"mappings":";;;AAEA,4BAA4B;AAC5B,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IACb,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IACf,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IAClB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IAChB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACf,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACf,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACf,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACjB,GAAG,EAAE,CA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
|
1
|
+
import { ILogTransport, LogTransportConfigBase } from '../types';
|
|
2
|
+
export declare type DatadogLogTransportConfig = LogTransportConfigBase;
|
|
3
|
+
/**
|
|
4
|
+
* A transport that sends logs to Datadog.
|
|
5
|
+
* Note: This requires the datadog reporter to be initialized for it to work.
|
|
6
|
+
*/
|
|
7
|
+
export declare function datadogTransport(config?: DatadogLogTransportConfig): ILogTransport;
|
|
8
|
+
//# sourceMappingURL=datadogTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datadogTransport.d.ts","sourceRoot":"","sources":["../../src/logger/datadogTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIjE,oBAAY,yBAAyB,GAAG,sBAAsB,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,yBAA8B,iBAStE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.datadogTransport = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const browser_logs_1 = require("@datadog/browser-logs");
|
|
6
|
+
/**
|
|
7
|
+
* A transport that sends logs to Datadog.
|
|
8
|
+
* Note: This requires the datadog reporter to be initialized for it to work.
|
|
9
|
+
*/
|
|
10
|
+
function datadogTransport(config = {}) {
|
|
11
|
+
const transport = {
|
|
12
|
+
...config,
|
|
13
|
+
log: ({ level, message, ...metadata }) => {
|
|
14
|
+
// Datadog expects a string message.
|
|
15
|
+
browser_logs_1.datadogLogs.logger[level]((0, utils_1.getLogMessage)(message), metadata);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
return transport;
|
|
19
|
+
}
|
|
20
|
+
exports.datadogTransport = datadogTransport;
|
|
21
|
+
//# sourceMappingURL=datadogTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datadogTransport.js","sourceRoot":"","sources":["../../src/logger/datadogTransport.ts"],"names":[],"mappings":";;;AACA,mCAAwC;AACxC,wDAAoD;AAIpD;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,SAAoC,EAAE;IACrE,MAAM,SAAS,GAAkB;QAC/B,GAAG,MAAM;QACT,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,EAAE,EAAE;YACvC,oCAAoC;YACpC,0BAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAA,qBAAa,EAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC9D,CAAC;KACF,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AATD,4CASC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ILogger, ILogTransport, LoggerOptions, LogLevel, Metadata } from '../types';
|
|
2
|
+
export * from './consoleTransport';
|
|
3
|
+
export * from './datadogTransport';
|
|
4
|
+
export declare const globalMetadata: Metadata;
|
|
5
|
+
export declare const logTransports: ILogTransport[];
|
|
6
|
+
export declare let globalLogLevel: LogLevel | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Sets the global log level.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setLogLevel(level: LogLevel | null): void;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Logger Instance.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createLogger(options?: LoggerOptions): ILogger;
|
|
15
|
+
export declare const logger: ILogger;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAA2B,MAAM,UAAU,CAAC;AAK9G,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,eAAO,MAAM,cAAc,EAAE,QAAa,CAAC;AAE3C,eAAO,MAAM,aAAa,EAAE,aAAa,EAAyB,CAAC;AAEnE,eAAO,IAAI,cAAc,EAAE,QAAQ,GAAG,SAAS,CAAC;AAChD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAgHjE;AAED,eAAO,MAAM,MAAM,SAAiB,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.logger = exports.createLogger = exports.setLogLevel = exports.globalLogLevel = exports.logTransports = exports.globalMetadata = void 0;
|
|
18
|
+
/* eslint-disable prefer-rest-params */
|
|
19
|
+
const types_1 = require("../types");
|
|
20
|
+
const utils_1 = require("../utils");
|
|
21
|
+
const consoleTransport_1 = require("./consoleTransport");
|
|
22
|
+
const utils_2 = require("./utils");
|
|
23
|
+
__exportStar(require("./consoleTransport"), exports);
|
|
24
|
+
__exportStar(require("./datadogTransport"), exports);
|
|
25
|
+
exports.globalMetadata = {};
|
|
26
|
+
exports.logTransports = [(0, consoleTransport_1.consoleTransport)()];
|
|
27
|
+
/**
|
|
28
|
+
* Sets the global log level.
|
|
29
|
+
*/
|
|
30
|
+
function setLogLevel(level) {
|
|
31
|
+
exports.globalLogLevel = level !== null && level !== void 0 ? level : undefined;
|
|
32
|
+
}
|
|
33
|
+
exports.setLogLevel = setLogLevel;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a Logger Instance.
|
|
36
|
+
*/
|
|
37
|
+
function createLogger(options = {}) {
|
|
38
|
+
var _a;
|
|
39
|
+
const rootMetadata = (_a = options.metadata) !== null && _a !== void 0 ? _a : {};
|
|
40
|
+
const logger = {
|
|
41
|
+
// impl loosely based on Winston Logger's dynamic log function
|
|
42
|
+
// https://github.com/winstonjs/winston/blob/master/lib/winston/logger.js
|
|
43
|
+
log() {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
let logInfo;
|
|
46
|
+
// Optimize for the hotpath of logging JSON literals
|
|
47
|
+
if (arguments.length === 1) {
|
|
48
|
+
logInfo = {
|
|
49
|
+
level: types_1.LogLevel.Info,
|
|
50
|
+
...arguments[0],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Slightly less hotpath, but worth optimizing for.
|
|
54
|
+
else if (arguments.length === 2) {
|
|
55
|
+
const [level, message] = Array.from(arguments);
|
|
56
|
+
if (message && typeof message === 'object') {
|
|
57
|
+
logInfo = {
|
|
58
|
+
...message,
|
|
59
|
+
level: (_a = message.level) !== null && _a !== void 0 ? _a : level,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
logInfo = {
|
|
64
|
+
level,
|
|
65
|
+
message,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const [level, message, ...splat] = Array.from(arguments);
|
|
71
|
+
const [meta] = splat;
|
|
72
|
+
if (typeof meta === 'object' && meta !== null) {
|
|
73
|
+
logInfo = {
|
|
74
|
+
...meta,
|
|
75
|
+
level,
|
|
76
|
+
splat: splat.slice(1),
|
|
77
|
+
message,
|
|
78
|
+
};
|
|
79
|
+
if (meta.message) {
|
|
80
|
+
logInfo.message = `${(0, utils_2.getLogMessage)(logInfo.message)} ${(0, utils_2.getLogMessage)(meta.message)}`;
|
|
81
|
+
}
|
|
82
|
+
if (meta.stack) {
|
|
83
|
+
logInfo.stack = meta.stack;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
logInfo = {
|
|
88
|
+
level,
|
|
89
|
+
splat,
|
|
90
|
+
message,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Check if we should log this message
|
|
95
|
+
const minLevel = exports.globalLogLevel !== null && exports.globalLogLevel !== void 0 ? exports.globalLogLevel : options.logLevel;
|
|
96
|
+
if (minLevel && !(0, utils_2.isAboveLevel)(logInfo.level, minLevel)) {
|
|
97
|
+
return logger;
|
|
98
|
+
}
|
|
99
|
+
// Add timestamp and root metadata.
|
|
100
|
+
// Ensure there is a message property.
|
|
101
|
+
logInfo = {
|
|
102
|
+
...exports.globalMetadata,
|
|
103
|
+
...rootMetadata,
|
|
104
|
+
timestamp: new Date().toISOString(),
|
|
105
|
+
...logInfo,
|
|
106
|
+
message: (_b = logInfo.message) !== null && _b !== void 0 ? _b : '',
|
|
107
|
+
};
|
|
108
|
+
for (const transport of exports.logTransports) {
|
|
109
|
+
if (transport.logLevel) {
|
|
110
|
+
if (!(0, utils_2.isAboveLevel)(logInfo.level, transport.logLevel)) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
transport.log({
|
|
115
|
+
...(0, utils_1.filterReporterMetadata)(logInfo, transport),
|
|
116
|
+
// These would break the transport if excluded.
|
|
117
|
+
level: logInfo.level,
|
|
118
|
+
message: logInfo.message,
|
|
119
|
+
splat: logInfo.splat,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return logger;
|
|
123
|
+
},
|
|
124
|
+
child(metadata) {
|
|
125
|
+
return createLogger({ ...rootMetadata, metadata });
|
|
126
|
+
},
|
|
127
|
+
startTimer() {
|
|
128
|
+
const start = new Date();
|
|
129
|
+
return {
|
|
130
|
+
logger: this,
|
|
131
|
+
done: ({ message, level, metadata } = {}) => {
|
|
132
|
+
const duration = new Date().getTime() - start.getTime();
|
|
133
|
+
logger.log(level !== null && level !== void 0 ? level : types_1.LogLevel.Info, message !== null && message !== void 0 ? message : 'Timer Completed', { duration, ...(metadata !== null && metadata !== void 0 ? metadata : {}) });
|
|
134
|
+
return true;
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
// Forward the log levels into the log function, essentially shortcuts.
|
|
139
|
+
debug: (...args) => logger.log(types_1.LogLevel.Debug, ...args),
|
|
140
|
+
info: (...args) => logger.log(types_1.LogLevel.Info, ...args),
|
|
141
|
+
warn: (...args) => logger.log(types_1.LogLevel.Warn, ...args),
|
|
142
|
+
error: (...args) => logger.log(types_1.LogLevel.Error, ...args),
|
|
143
|
+
};
|
|
144
|
+
return logger;
|
|
145
|
+
}
|
|
146
|
+
exports.createLogger = createLogger;
|
|
147
|
+
exports.logger = createLogger();
|
|
148
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,oCAA8G;AAC9G,oCAAkD;AAClD,yDAAsD;AACtD,mCAAsD;AAEtD,qDAAmC;AACnC,qDAAmC;AAEtB,QAAA,cAAc,GAAa,EAAE,CAAC;AAE9B,QAAA,aAAa,GAAoB,CAAC,IAAA,mCAAgB,GAAE,CAAC,CAAC;AAGnE;;GAEG;AACH,SAAgB,WAAW,CAAC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CAAC,MAAM,CAAC,GAAG,CAAC,gBAAQ,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC;KACxD,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAhHD,oCAgHC;AAEY,QAAA,MAAM,GAAG,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/logger/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const reporters_1 = require("../reporters");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
// This isn't actually asserting anything.
|
|
8
|
+
// But it ensures that the logs look correct, and no errors get thrown.
|
|
9
|
+
describe('logger', () => {
|
|
10
|
+
const logger = (0, _1.createLogger)({
|
|
11
|
+
metadata: {
|
|
12
|
+
service: 'test',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
// Manually set the log transports.
|
|
16
|
+
_1.logTransports.length = 0;
|
|
17
|
+
const transport = (0, _1.consoleTransport)({
|
|
18
|
+
// So we can see everything.
|
|
19
|
+
ignoreMetadataPatterns: [],
|
|
20
|
+
});
|
|
21
|
+
_1.logTransports.push(transport);
|
|
22
|
+
it('should log', async () => {
|
|
23
|
+
logger.log({
|
|
24
|
+
level: 'info',
|
|
25
|
+
message: 'data',
|
|
26
|
+
});
|
|
27
|
+
logger.log({ data: 'obj' });
|
|
28
|
+
logger.log(types_1.LogLevel.Debug, 'level, message', { data: 'obj' });
|
|
29
|
+
logger.log(types_1.LogLevel.Debug, 'level, message, metadata', { data: 'obj' });
|
|
30
|
+
(0, __1.init)({
|
|
31
|
+
service: 'test-service',
|
|
32
|
+
environment: 'test',
|
|
33
|
+
version: 'no-version',
|
|
34
|
+
defaultMetadata: {
|
|
35
|
+
application: 'test',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const infoLogger = logger.child({ isLevel: 'info' });
|
|
39
|
+
infoLogger.info('info call, message');
|
|
40
|
+
infoLogger.info('info call, message, metadata', { data: 'metadataobj' });
|
|
41
|
+
const timer = logger.startTimer();
|
|
42
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
43
|
+
timer.done({ message: 'timer done', metadata: { id: 1 } });
|
|
44
|
+
(0, _1.setLogLevel)(types_1.LogLevel.Info);
|
|
45
|
+
(0, reporters_1.addMetadata)({ global: 'metadata' });
|
|
46
|
+
logger.debug('You should not see this');
|
|
47
|
+
logger.info('You should see this with { global: "metadata" }');
|
|
48
|
+
(0, _1.setLogLevel)(null);
|
|
49
|
+
(0, reporters_1.setUser)({
|
|
50
|
+
id: '123',
|
|
51
|
+
email: 'test@example.com',
|
|
52
|
+
});
|
|
53
|
+
logger.debug('debug call, user metadata');
|
|
54
|
+
transport.logLevel = types_1.LogLevel.Info;
|
|
55
|
+
logger.debug('You should not see this');
|
|
56
|
+
logger.info('You should see this');
|
|
57
|
+
transport.logLevel = undefined;
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/logger/index.test.ts"],"names":[],"mappings":";;AAAA,wBAAoG;AACpG,0BAA0B;AAC1B,4CAAoD;AACpD,oCAAoC;AAEpC,0CAA0C;AAC1C,uEAAuE;AACvE,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,MAAM,MAAM,GAAG,IAAA,eAAY,EAAC;QAC1B,QAAQ,EAAE;YACR,OAAO,EAAE,MAAM;SAChB;KACF,CAAC,CAAC;IAEH,mCAAmC;IACnC,gBAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,MAAM,SAAS,GAAG,IAAA,mBAAgB,EAAC;QACjC,4BAA4B;QAC5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C,gBAAQ,CAAC,IAAI,CAAC,CAAC;QACjC,IAAA,uBAAW,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QAEpC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;QAE/D,IAAA,cAAiB,EAAC,IAAI,CAAC,CAAC;QACxB,IAAA,mBAAO,EAAC;YACN,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,kBAAkB;SAC1B,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAE1C,SAAS,CAAC,QAAQ,GAAG,gBAAQ,CAAC,IAAI,CAAC;QACnC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACnC,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LogLevel } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a log level is above the global log level.
|
|
4
|
+
* @param level The log level to check
|
|
5
|
+
* @param checkLevel THe log level to check against
|
|
6
|
+
* @returns Is above the checkLevel?
|
|
7
|
+
*/
|
|
8
|
+
export declare function isAboveLevel(level: LogLevel, checkLevel: LogLevel): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Ensures a message output is a string.
|
|
11
|
+
* @param message The message to assert is/convert to a string
|
|
12
|
+
* @returns The message as a string
|
|
13
|
+
*/
|
|
14
|
+
export declare function getLogMessage(message: any): string;
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/logger/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,GAAG,OAAO,CAG3E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,CASlD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLogMessage = exports.isAboveLevel = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a log level is above the global log level.
|
|
7
|
+
* @param level The log level to check
|
|
8
|
+
* @param checkLevel THe log level to check against
|
|
9
|
+
* @returns Is above the checkLevel?
|
|
10
|
+
*/
|
|
11
|
+
function isAboveLevel(level, checkLevel) {
|
|
12
|
+
const levels = [types_1.LogLevel.Debug, types_1.LogLevel.Info, types_1.LogLevel.Warn, types_1.LogLevel.Error];
|
|
13
|
+
return levels.indexOf(level) >= levels.indexOf(checkLevel);
|
|
14
|
+
}
|
|
15
|
+
exports.isAboveLevel = isAboveLevel;
|
|
16
|
+
/**
|
|
17
|
+
* Ensures a message output is a string.
|
|
18
|
+
* @param message The message to assert is/convert to a string
|
|
19
|
+
* @returns The message as a string
|
|
20
|
+
*/
|
|
21
|
+
function getLogMessage(message) {
|
|
22
|
+
if (typeof message === 'string') {
|
|
23
|
+
return message;
|
|
24
|
+
}
|
|
25
|
+
if (typeof message === 'object' && message !== null) {
|
|
26
|
+
const data = { ...message };
|
|
27
|
+
return JSON.stringify(data);
|
|
28
|
+
}
|
|
29
|
+
return String(message);
|
|
30
|
+
}
|
|
31
|
+
exports.getLogMessage = getLogMessage;
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/logger/utils.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AAEpC;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,KAAe,EAAE,UAAoB;IAChE,MAAM,MAAM,GAAG,CAAC,gBAAQ,CAAC,KAAK,EAAE,gBAAQ,CAAC,IAAI,EAAE,gBAAQ,CAAC,IAAI,EAAE,gBAAQ,CAAC,KAAK,CAAC,CAAC;IAC9E,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC7D,CAAC;AAHD,oCAGC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAY;IACxC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO,OAAO,CAAC;KAChB;IACD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;QACnD,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAC7B;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AATD,sCASC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IReporter, ReporterConfigBase, ServiceInfo } from '../types';
|
|
2
|
-
|
|
2
|
+
declare type AttributeMap = Record<string, string[] | string | null>;
|
|
3
3
|
export interface AmplifyReporterConfig extends ReporterConfigBase {
|
|
4
4
|
/**
|
|
5
5
|
* AWS Region for Amplify.
|
|
@@ -67,7 +67,7 @@ export declare function amplifyReporter(info: ServiceInfo, config: AmplifyReport
|
|
|
67
67
|
/**
|
|
68
68
|
* Pinpoint has strict attribute name and value length limits
|
|
69
69
|
*/
|
|
70
|
-
export declare function asAttributeMap(values: Record<string, unknown>, groupValues?: boolean
|
|
70
|
+
export declare function asAttributeMap(values: Record<string, unknown>, groupValues?: boolean): AttributeMap;
|
|
71
71
|
/**
|
|
72
72
|
* Pinpoint expects `endpoint.attributes` and `endpoint.userAttributes` to have
|
|
73
73
|
* values which are string arrays. This function takes in an object and ensures
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amplifyReporter.d.ts","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,kBAAkB,EAGlB,WAAW,EACZ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"amplifyReporter.d.ts","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,kBAAkB,EAGlB,WAAW,EACZ,MAAM,UAAU,CAAC;AAMlB,aAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;AAE7D,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,cAAc,EAAE,MAAM,GAAG,KAAK,CAAC;IAC/B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,8BAA8B,CAAC;CAC5C;AAED;;;;GAIG;AACH,aAAK,8BAA8B,GAAG;IACpC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAmG3F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,UAAO,GAAG,YAAY,CAqBhG;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,SAAS,GAAE,MAAM,GAAG,SAAqB,EACzC,WAAW,UAAO,GACjB,YAAY,CAsBd"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildAttributeMap = exports.asAttributeMap = exports.amplifyReporter = void 0;
|
|
4
4
|
const auth_1 = require("@aws-amplify/auth");
|
|
5
5
|
const analytics_1 = require("@aws-amplify/analytics");
|
|
6
|
-
const
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
7
|
function amplifyReporter(info, config) {
|
|
8
8
|
var _a;
|
|
9
9
|
if (config.identityPoolId !== false) {
|
|
@@ -51,15 +51,11 @@ function amplifyReporter(info, config) {
|
|
|
51
51
|
attributes: asAttributeMap({
|
|
52
52
|
...event.metadata,
|
|
53
53
|
...event.tags,
|
|
54
|
-
}, false
|
|
54
|
+
}, false),
|
|
55
55
|
metrics: event.metrics,
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
58
|
addBreadcrumb: function (breadcrumb) {
|
|
59
|
-
var _a;
|
|
60
|
-
if (breadcrumb.category && ((_a = config.ignoreBreadcrumbCategories) === null || _a === void 0 ? void 0 : _a.includes(breadcrumb.category))) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
59
|
reporter.trackEvent({
|
|
64
60
|
message: breadcrumb.message,
|
|
65
61
|
metadata: {
|
|
@@ -69,7 +65,7 @@ function amplifyReporter(info, config) {
|
|
|
69
65
|
});
|
|
70
66
|
},
|
|
71
67
|
addMetadata: function (metadata) {
|
|
72
|
-
Object.assign(allMetadata, asAttributeMap(metadata, true
|
|
68
|
+
Object.assign(allMetadata, asAttributeMap(metadata, true));
|
|
73
69
|
analytics_1.Analytics.updateEndpoint({
|
|
74
70
|
attributes: allMetadata,
|
|
75
71
|
}).catch(() => {
|
|
@@ -105,11 +101,9 @@ exports.amplifyReporter = amplifyReporter;
|
|
|
105
101
|
/**
|
|
106
102
|
* Pinpoint has strict attribute name and value length limits
|
|
107
103
|
*/
|
|
108
|
-
|
|
109
|
-
function asAttributeMap(values, groupValues = true, ignorePatterns = []) {
|
|
104
|
+
function asAttributeMap(values, groupValues = true) {
|
|
110
105
|
const attributeMap = buildAttributeMap(values, undefined, groupValues);
|
|
111
|
-
const
|
|
112
|
-
const checkedEntries = Object.entries(filteredAttributeMap).map(([key, value]) => {
|
|
106
|
+
const checkedEntries = Object.entries(attributeMap).map(([key, value]) => {
|
|
113
107
|
var _a, _b;
|
|
114
108
|
const truncatedKey = key.length > 50 ? `___${key.slice(-47)}` : key;
|
|
115
109
|
const truncatedValue = Array.isArray(value)
|
|
@@ -117,6 +111,13 @@ function asAttributeMap(values, groupValues = true, ignorePatterns = []) {
|
|
|
117
111
|
: (_b = value === null || value === void 0 ? void 0 : value.slice(0, 100)) !== null && _b !== void 0 ? _b : null;
|
|
118
112
|
return [truncatedKey, truncatedValue];
|
|
119
113
|
});
|
|
114
|
+
// Pinpoint only accepts 40 attributes
|
|
115
|
+
if (checkedEntries.length > 40) {
|
|
116
|
+
logger_1.logger.error(`Amplify only allows 40 attributes per event, truncating to 40 attributes`, {
|
|
117
|
+
attributes: checkedEntries,
|
|
118
|
+
});
|
|
119
|
+
checkedEntries.length = 40;
|
|
120
|
+
}
|
|
120
121
|
return Object.fromEntries(checkedEntries);
|
|
121
122
|
}
|
|
122
123
|
exports.asAttributeMap = asAttributeMap;
|
|
@@ -125,9 +126,7 @@ exports.asAttributeMap = asAttributeMap;
|
|
|
125
126
|
* values which are string arrays. This function takes in an object and ensures
|
|
126
127
|
* all of its values are of type `string[]` to appease Pinpoint.
|
|
127
128
|
*/
|
|
128
|
-
function buildAttributeMap(
|
|
129
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
130
|
-
values, parentKey = undefined, groupValues = true) {
|
|
129
|
+
function buildAttributeMap(values, parentKey = undefined, groupValues = true) {
|
|
131
130
|
const valuesWithStringArrays = {};
|
|
132
131
|
Object.entries(values).forEach(([key, value]) => {
|
|
133
132
|
const combinedKey = parentKey ? [parentKey, key].join('.') : key;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amplifyReporter.js","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":";;;AASA,4CAAyC;AACzC,sDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"amplifyReporter.js","sourceRoot":"","sources":["../../src/reporters/amplifyReporter.ts"],"names":[],"mappings":";;;AASA,4CAAyC;AACzC,sDAAmD;AACnD,sCAAmC;AAyEnC,SAAgB,eAAe,CAAC,IAAiB,EAAE,MAA6B;;IAC9E,IAAI,MAAM,CAAC,cAAc,KAAK,KAAK,EAAE;QACnC,WAAI,CAAC,SAAS,CAAC;YACb,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;SAChD,CAAC,CAAC;KACJ;IAED,MAAM,WAAW,GAAG,cAAc,CAAC;QACjC,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;QAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC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