@crimson-education/browser-logger 2.0.1 → 2.0.2-cognito.1
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/lib/index.d.ts +26 -26
- package/lib/index.js +140 -140
- package/lib/reporters/amplifyReporter.d.ts +51 -47
- package/lib/reporters/amplifyReporter.d.ts.map +1 -1
- package/lib/reporters/amplifyReporter.js +158 -156
- package/lib/reporters/amplifyReporter.js.map +1 -1
- package/lib/reporters/amplifyReporter.test.d.ts +1 -1
- package/lib/reporters/amplifyReporter.test.js +61 -61
- package/lib/reporters/datadogReporter.d.ts +26 -26
- package/lib/reporters/datadogReporter.js +177 -177
- package/lib/reporters/gtmReporter.d.ts +7 -7
- package/lib/reporters/gtmReporter.js +42 -42
- package/lib/reporters/index.d.ts +28 -28
- package/lib/reporters/index.js +2 -2
- package/lib/types.d.ts +47 -47
- package/lib/types.js +10 -10
- package/lib/utils.d.ts +4 -4
- package/lib/utils.js +46 -46
- package/package.json +1 -1
- package/src/reporters/amplifyReporter.ts +13 -7
package/lib/utils.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.consoleLogger = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
-
const _1 = require(".");
|
|
7
|
-
function consoleLogger(name, options) {
|
|
8
|
-
const logger = {
|
|
9
|
-
startTimer() {
|
|
10
|
-
const start = new Date();
|
|
11
|
-
return {
|
|
12
|
-
logger: this,
|
|
13
|
-
done: (args) => {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
const duration = new Date().getTime() - start.getTime();
|
|
16
|
-
logger[(_a = args === null || args === void 0 ? void 0 : args.level) !== null && _a !== void 0 ? _a : _1.LogLevel.Info](`${(_b = args === null || args === void 0 ? void 0 : args.message) !== null && _b !== void 0 ? _b : 'Timer'} completed in: ${duration}`);
|
|
17
|
-
return true;
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
child(metadata, name) {
|
|
22
|
-
return consoleLogger(name, { metadata });
|
|
23
|
-
},
|
|
24
|
-
log: (level, message, metadata) => {
|
|
25
|
-
return logger[level](message, message);
|
|
26
|
-
},
|
|
27
|
-
debug: (...args) => {
|
|
28
|
-
console.debug(...args);
|
|
29
|
-
return logger;
|
|
30
|
-
},
|
|
31
|
-
info: (...args) => {
|
|
32
|
-
console.log(...args);
|
|
33
|
-
return logger;
|
|
34
|
-
},
|
|
35
|
-
warn: (...args) => {
|
|
36
|
-
console.warn(...args);
|
|
37
|
-
return logger;
|
|
38
|
-
},
|
|
39
|
-
error: (...args) => {
|
|
40
|
-
console.error(...args);
|
|
41
|
-
return logger;
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
return logger;
|
|
45
|
-
}
|
|
46
|
-
exports.consoleLogger = consoleLogger;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.consoleLogger = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
function consoleLogger(name, options) {
|
|
8
|
+
const logger = {
|
|
9
|
+
startTimer() {
|
|
10
|
+
const start = new Date();
|
|
11
|
+
return {
|
|
12
|
+
logger: this,
|
|
13
|
+
done: (args) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const duration = new Date().getTime() - start.getTime();
|
|
16
|
+
logger[(_a = args === null || args === void 0 ? void 0 : args.level) !== null && _a !== void 0 ? _a : _1.LogLevel.Info](`${(_b = args === null || args === void 0 ? void 0 : args.message) !== null && _b !== void 0 ? _b : 'Timer'} completed in: ${duration}`);
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
child(metadata, name) {
|
|
22
|
+
return consoleLogger(name, { metadata });
|
|
23
|
+
},
|
|
24
|
+
log: (level, message, metadata) => {
|
|
25
|
+
return logger[level](message, message);
|
|
26
|
+
},
|
|
27
|
+
debug: (...args) => {
|
|
28
|
+
console.debug(...args);
|
|
29
|
+
return logger;
|
|
30
|
+
},
|
|
31
|
+
info: (...args) => {
|
|
32
|
+
console.log(...args);
|
|
33
|
+
return logger;
|
|
34
|
+
},
|
|
35
|
+
warn: (...args) => {
|
|
36
|
+
console.warn(...args);
|
|
37
|
+
return logger;
|
|
38
|
+
},
|
|
39
|
+
error: (...args) => {
|
|
40
|
+
console.error(...args);
|
|
41
|
+
return logger;
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
return logger;
|
|
45
|
+
}
|
|
46
|
+
exports.consoleLogger = consoleLogger;
|
|
47
47
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -5,7 +5,11 @@ import { Analytics } from '@aws-amplify/analytics';
|
|
|
5
5
|
|
|
6
6
|
export type AmplifyReporterConfig = {
|
|
7
7
|
region: string;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The Identity Pool ID to use for reporting, if set to false, Auth.configure is not called.
|
|
10
|
+
* This must be called manually for the reporter to work.
|
|
11
|
+
*/
|
|
12
|
+
identityPoolId: string | false;
|
|
9
13
|
analyticsAppId: string;
|
|
10
14
|
autoTrackPageViews?: boolean;
|
|
11
15
|
autoTrackEvents?: boolean;
|
|
@@ -35,12 +39,14 @@ type AmplifyReporterBufferingConfig = {
|
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
export function amplifyReporter(info: ServiceInfo, config: AmplifyReporterConfig): IReporter {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if (config.identityPoolId !== false) {
|
|
43
|
+
Auth.configure({
|
|
44
|
+
region: config.region,
|
|
45
|
+
identityPoolId: config.identityPoolId,
|
|
46
|
+
userPoolId: config.userPoolId,
|
|
47
|
+
userPoolWebClientId: config.userPoolWebClientId,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
44
50
|
|
|
45
51
|
const allMetadata = asAttributeMap({
|
|
46
52
|
appName: info.service,
|