@crimson-education/browser-logger 1.1.1 → 1.3.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 +36 -2
- package/lib/index.d.ts +29 -27
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +144 -140
- package/lib/index.js.map +1 -1
- package/lib/reporters/amplifyReporter.d.ts +14 -0
- package/lib/reporters/amplifyReporter.d.ts.map +1 -0
- package/lib/reporters/amplifyReporter.js +96 -0
- package/lib/reporters/amplifyReporter.js.map +1 -0
- package/lib/reporters/datadogReporter.d.ts +26 -26
- package/lib/reporters/datadogReporter.d.ts.map +1 -1
- package/lib/reporters/datadogReporter.js +177 -176
- package/lib/reporters/datadogReporter.js.map +1 -1
- package/lib/reporters/gtmReporter.d.ts +7 -7
- package/lib/reporters/gtmReporter.d.ts.map +1 -1
- package/lib/reporters/gtmReporter.js +42 -41
- package/lib/reporters/gtmReporter.js.map +1 -1
- package/lib/reporters/index.d.ts +28 -27
- package/lib/reporters/index.d.ts.map +1 -1
- package/lib/reporters/index.js +2 -2
- package/lib/reporters/newrelicReporter.d.ts +3 -3
- package/lib/reporters/newrelicReporter.d.ts.map +1 -1
- package/lib/reporters/newrelicReporter.js +51 -50
- package/lib/reporters/newrelicReporter.js.map +1 -1
- package/lib/reporters/sentryReporter.d.ts +10 -10
- package/lib/reporters/sentryReporter.d.ts.map +1 -1
- package/lib/reporters/sentryReporter.js +102 -99
- package/lib/reporters/sentryReporter.js.map +1 -1
- package/lib/types.d.ts +47 -46
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +10 -10
- package/lib/types.js.map +1 -1
- package/lib/utils.d.ts +4 -4
- package/lib/utils.js +46 -46
- package/package.json +3 -2
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newrelicReporter = void 0;
|
|
4
|
-
function newrelicReporter(info) {
|
|
5
|
-
var _a;
|
|
6
|
-
const newrelic = window.newrelic;
|
|
7
|
-
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.addRelease) === null || _a === void 0 ? void 0 : _a.call(newrelic, info.service, info.version);
|
|
8
|
-
const reporter = {
|
|
9
|
-
trackEvent: function (event) {
|
|
10
|
-
var _a;
|
|
11
|
-
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.addPageAction) === null || _a === void 0 ? void 0 : _a.call(newrelic, event.message, {
|
|
12
|
-
...event.metadata,
|
|
13
|
-
...event.tags,
|
|
14
|
-
...
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
...
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newrelicReporter = void 0;
|
|
4
|
+
function newrelicReporter(info) {
|
|
5
|
+
var _a;
|
|
6
|
+
const newrelic = window.newrelic;
|
|
7
|
+
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.addRelease) === null || _a === void 0 ? void 0 : _a.call(newrelic, info.service, info.version);
|
|
8
|
+
const reporter = {
|
|
9
|
+
trackEvent: function (event) {
|
|
10
|
+
var _a;
|
|
11
|
+
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.addPageAction) === null || _a === void 0 ? void 0 : _a.call(newrelic, event.message, {
|
|
12
|
+
...event.metadata,
|
|
13
|
+
...event.tags,
|
|
14
|
+
...event.metrics,
|
|
15
|
+
...(event.level ? { level: event.level } : {}),
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
addBreadcrumb: function (breadcrumb) {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.addPageAction) === null || _a === void 0 ? void 0 : _a.call(newrelic, breadcrumb.message, {
|
|
21
|
+
...breadcrumb.metadata,
|
|
22
|
+
...(breadcrumb.category ? { category: breadcrumb.category } : {}),
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
addMetadata: function (metadata) {
|
|
26
|
+
var _a;
|
|
27
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
28
|
+
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.setCustomAttribute) === null || _a === void 0 ? void 0 : _a.call(newrelic, key, value);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
setUser: function (user) {
|
|
32
|
+
reporter.addMetadata({ user });
|
|
33
|
+
},
|
|
34
|
+
setRouteName: function (routeName) {
|
|
35
|
+
var _a;
|
|
36
|
+
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.setCurrentRouteName) === null || _a === void 0 ? void 0 : _a.call(newrelic, routeName);
|
|
37
|
+
},
|
|
38
|
+
setPageName: function (pageName) {
|
|
39
|
+
var _a;
|
|
40
|
+
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.setPageViewName) === null || _a === void 0 ? void 0 : _a.call(newrelic, pageName);
|
|
41
|
+
},
|
|
42
|
+
reportError: function (error, metadata) {
|
|
43
|
+
var _a;
|
|
44
|
+
(_a = newrelic === null || newrelic === void 0 ? void 0 : newrelic.noticeError) === null || _a === void 0 ? void 0 : _a.call(newrelic, error, metadata);
|
|
45
|
+
},
|
|
46
|
+
recordSession: function () { },
|
|
47
|
+
recordSessionStop: function () { },
|
|
48
|
+
};
|
|
49
|
+
return reporter;
|
|
50
|
+
}
|
|
51
|
+
exports.newrelicReporter = newrelicReporter;
|
|
51
52
|
//# sourceMappingURL=newrelicReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newrelicReporter.js","sourceRoot":"","sources":["../../src/reporters/newrelicReporter.ts"],"names":[],"mappings":";;;AAGA,SAAgB,gBAAgB,CAAC,IAAiB;;IAChD,MAAM,QAAQ,GAAwC,MAAM,CAAC,QAAQ,CAAC;IACtE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,UAAU,+CAApB,QAAQ,EAAe,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAEnD,MAAM,QAAQ,GAAc;QAC1B,UAAU,EAAE,UAAU,KAAoB;;YACxC,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,+CAAvB,QAAQ,EAAkB,KAAK,CAAC,OAAO,EAAE;gBACvC,GAAG,KAAK,CAAC,QAAQ;gBACjB,GAAG,KAAK,CAAC,IAAI;gBACb,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC/C,CAAC,CAAC;QACL,CAAC;QACD,aAAa,EAAE,UAAU,UAA8B;;YACrD,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,+CAAvB,QAAQ,EAAkB,UAAU,CAAC,OAAO,EAAE;gBAC5C,GAAG,UAAU,CAAC,QAAQ;gBACtB,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAClE,CAAC,CAAC;QACL,CAAC;QACD,WAAW,EAAE,UAAU,QAAkB;;YACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,O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Q,aAAR,QAAQ,uBAAR,QAAQ,CAAE,eAAe,+CAAzB,QAAQ,EAAoB,QAAQ,CAAC,CAAC;QACxC,CAAC;QACD,WAAW,EAAE,UAAU,KAAkB,EAAE,QAAmB;;YAC5D,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,+CAArB,QAAQ,EAAgB,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;QACD,aAAa,EAAE,cAAmB,CAAC;QACnC,iBAAiB,EAAE,cAAmB,CAAC;KACxC,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAzCD,4CAyCC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IReporter } from '.';
|
|
2
|
-
import { ServiceInfo } from '../types';
|
|
3
|
-
export declare type SentryReporterConfig = {
|
|
4
|
-
dsn: string;
|
|
5
|
-
release?: string;
|
|
6
|
-
proxyUrl?: string;
|
|
7
|
-
allowUrls?: (string | RegExp)[];
|
|
8
|
-
sampleRate?: number;
|
|
9
|
-
};
|
|
10
|
-
export declare function sentryReporter(info: ServiceInfo, config: SentryReporterConfig): IReporter;
|
|
1
|
+
import { IReporter } from '.';
|
|
2
|
+
import { ServiceInfo } from '../types';
|
|
3
|
+
export declare type SentryReporterConfig = {
|
|
4
|
+
dsn: string;
|
|
5
|
+
release?: string;
|
|
6
|
+
proxyUrl?: string;
|
|
7
|
+
allowUrls?: (string | RegExp)[];
|
|
8
|
+
sampleRate?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function sentryReporter(info: ServiceInfo, config: SentryReporterConfig): IReporter;
|
|
11
11
|
//# sourceMappingURL=sentryReporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentryReporter.d.ts","sourceRoot":"","sources":["../../src/reporters/sentryReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqC,MAAM,GAAG,CAAC;AACjE,OAAO,EAAqC,WAAW,EAAE,MAAM,UAAU,CAAC;AAM1E,oBAAY,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAmBF,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"sentryReporter.d.ts","sourceRoot":"","sources":["../../src/reporters/sentryReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqC,MAAM,GAAG,CAAC;AACjE,OAAO,EAAqC,WAAW,EAAE,MAAM,UAAU,CAAC;AAM1E,oBAAY,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAmBF,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAgEzF"}
|
|
@@ -1,100 +1,103 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.sentryReporter = void 0;
|
|
23
|
-
const Sentry = __importStar(require("@sentry/react"));
|
|
24
|
-
const tracing_1 = require("@sentry/tracing");
|
|
25
|
-
const __1 = require("..");
|
|
26
|
-
const react_1 = require("@sentry/react");
|
|
27
|
-
function getSentrySeverity(level) {
|
|
28
|
-
switch (level) {
|
|
29
|
-
case __1.LogLevel.Error:
|
|
30
|
-
return react_1.Severity.Error;
|
|
31
|
-
case __1.LogLevel.Warn:
|
|
32
|
-
return react_1.Severity.Warning;
|
|
33
|
-
case __1.LogLevel.Info:
|
|
34
|
-
return react_1.Severity.Info;
|
|
35
|
-
case __1.LogLevel.Debug:
|
|
36
|
-
default:
|
|
37
|
-
return react_1.Severity.Debug;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function sentryReporter(info, config) {
|
|
41
|
-
var _a, _b;
|
|
42
|
-
Sentry.init({
|
|
43
|
-
dsn: config.dsn,
|
|
44
|
-
tunnel: config.proxyUrl,
|
|
45
|
-
integrations: [new tracing_1.Integrations.BrowserTracing()],
|
|
46
|
-
allowUrls: config.allowUrls,
|
|
47
|
-
environment: info.environment,
|
|
48
|
-
release: (_a = config.release) !== null && _a !== void 0 ? _a : info.version,
|
|
49
|
-
// Set tracesSampleRate to 1.0 to capture 100%
|
|
50
|
-
// of transactions for performance monitoring.
|
|
51
|
-
tracesSampleRate: (_b = config.sampleRate) !== null && _b !== void 0 ? _b : 1.0,
|
|
52
|
-
});
|
|
53
|
-
const reporter = {
|
|
54
|
-
trackEvent: function (event) {
|
|
55
|
-
Sentry.captureEvent({
|
|
56
|
-
level: event.level ? getSentrySeverity(event.level) : undefined,
|
|
57
|
-
message: event.message,
|
|
58
|
-
extra:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
Sentry.setTag('
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
Sentry.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.sentryReporter = void 0;
|
|
23
|
+
const Sentry = __importStar(require("@sentry/react"));
|
|
24
|
+
const tracing_1 = require("@sentry/tracing");
|
|
25
|
+
const __1 = require("..");
|
|
26
|
+
const react_1 = require("@sentry/react");
|
|
27
|
+
function getSentrySeverity(level) {
|
|
28
|
+
switch (level) {
|
|
29
|
+
case __1.LogLevel.Error:
|
|
30
|
+
return react_1.Severity.Error;
|
|
31
|
+
case __1.LogLevel.Warn:
|
|
32
|
+
return react_1.Severity.Warning;
|
|
33
|
+
case __1.LogLevel.Info:
|
|
34
|
+
return react_1.Severity.Info;
|
|
35
|
+
case __1.LogLevel.Debug:
|
|
36
|
+
default:
|
|
37
|
+
return react_1.Severity.Debug;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function sentryReporter(info, config) {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
Sentry.init({
|
|
43
|
+
dsn: config.dsn,
|
|
44
|
+
tunnel: config.proxyUrl,
|
|
45
|
+
integrations: [new tracing_1.Integrations.BrowserTracing()],
|
|
46
|
+
allowUrls: config.allowUrls,
|
|
47
|
+
environment: info.environment,
|
|
48
|
+
release: (_a = config.release) !== null && _a !== void 0 ? _a : info.version,
|
|
49
|
+
// Set tracesSampleRate to 1.0 to capture 100%
|
|
50
|
+
// of transactions for performance monitoring.
|
|
51
|
+
tracesSampleRate: (_b = config.sampleRate) !== null && _b !== void 0 ? _b : 1.0,
|
|
52
|
+
});
|
|
53
|
+
const reporter = {
|
|
54
|
+
trackEvent: function (event) {
|
|
55
|
+
Sentry.captureEvent({
|
|
56
|
+
level: event.level ? getSentrySeverity(event.level) : undefined,
|
|
57
|
+
message: event.message,
|
|
58
|
+
extra: {
|
|
59
|
+
...event.metadata,
|
|
60
|
+
...event.metrics,
|
|
61
|
+
},
|
|
62
|
+
tags: event.tags,
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
addBreadcrumb: function (breadcrumb) {
|
|
66
|
+
Sentry.addBreadcrumb({
|
|
67
|
+
category: breadcrumb.category,
|
|
68
|
+
message: breadcrumb.message,
|
|
69
|
+
data: breadcrumb.metadata,
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
addMetadata: function (metadata) {
|
|
73
|
+
Sentry.setExtras(metadata);
|
|
74
|
+
},
|
|
75
|
+
setUser: function (user) {
|
|
76
|
+
var _a;
|
|
77
|
+
Sentry.setUser(user
|
|
78
|
+
? {
|
|
79
|
+
id: user.id,
|
|
80
|
+
email: user.email,
|
|
81
|
+
name: (_a = user.name) !== null && _a !== void 0 ? _a : user.email,
|
|
82
|
+
username: user.username,
|
|
83
|
+
}
|
|
84
|
+
: null);
|
|
85
|
+
},
|
|
86
|
+
setRouteName: function (routeName) {
|
|
87
|
+
Sentry.setTag('routeName', routeName);
|
|
88
|
+
},
|
|
89
|
+
setPageName: function (pageName) {
|
|
90
|
+
Sentry.setTag('pageName', pageName);
|
|
91
|
+
},
|
|
92
|
+
reportError: function (error, metadata) {
|
|
93
|
+
Sentry.captureException(error, {
|
|
94
|
+
extra: metadata,
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
recordSession: function () { },
|
|
98
|
+
recordSessionStop: function () { },
|
|
99
|
+
};
|
|
100
|
+
return reporter;
|
|
101
|
+
}
|
|
102
|
+
exports.sentryReporter = sentryReporter;
|
|
100
103
|
//# sourceMappingURL=sentryReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentryReporter.js","sourceRoot":"","sources":["../../src/reporters/sentryReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;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.ts
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
export declare type Metadata = Record<string, any>;
|
|
2
|
-
export declare type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
(message: string,
|
|
24
|
-
(message: any): ILogger;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(level: LogLevel, message: string,
|
|
29
|
-
(level: LogLevel, message: any): ILogger;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
export declare type Metadata = Record<string, any>;
|
|
2
|
+
export declare type Metrics = Record<string, number>;
|
|
3
|
+
export declare type ServiceInfo = {
|
|
4
|
+
service: string;
|
|
5
|
+
environment: string;
|
|
6
|
+
version: string;
|
|
7
|
+
defaultMetadata?: Metadata;
|
|
8
|
+
};
|
|
9
|
+
export declare type ReportUser = {
|
|
10
|
+
id: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
username?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare type ReportError = Error | string;
|
|
16
|
+
export declare enum LogLevel {
|
|
17
|
+
Debug = "debug",
|
|
18
|
+
Info = "info",
|
|
19
|
+
Warn = "warn",
|
|
20
|
+
Error = "error"
|
|
21
|
+
}
|
|
22
|
+
export interface LogLevelMethod {
|
|
23
|
+
(message: string, metadata?: any): ILogger;
|
|
24
|
+
(message: string, ...meta: any[]): ILogger;
|
|
25
|
+
(message: any): ILogger;
|
|
26
|
+
}
|
|
27
|
+
export interface LogMethod {
|
|
28
|
+
(level: LogLevel, message: string, metadata?: any): ILogger;
|
|
29
|
+
(level: LogLevel, message: string, ...meta: any[]): ILogger;
|
|
30
|
+
(level: LogLevel, message: any): ILogger;
|
|
31
|
+
}
|
|
32
|
+
export interface Profiler {
|
|
33
|
+
logger: ILogger;
|
|
34
|
+
done(info?: {
|
|
35
|
+
message?: string;
|
|
36
|
+
level?: LogLevel;
|
|
37
|
+
}): boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface ILogger {
|
|
40
|
+
startTimer(): Profiler;
|
|
41
|
+
child(metadata?: Metadata, name?: string): ILogger;
|
|
42
|
+
log: LogMethod;
|
|
43
|
+
debug: LogLevelMethod;
|
|
44
|
+
info: LogLevelMethod;
|
|
45
|
+
warn: LogLevelMethod;
|
|
46
|
+
error: LogLevelMethod;
|
|
47
|
+
}
|
|
47
48
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,oBAAY,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE3C,oBAAY,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,QAAQ,CAAC;CAC5B,CAAC;AAEF,oBAAY,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1F,oBAAY,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC;AAEzC,oBAAY,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IAChB,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;CAC9D;AAED,MAAM,WAAW,OAAO;IACtB,UAAU,IAAI,QAAQ,CAAC;IACvB,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEnD,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,cAAc,CAAC;CACvB"}
|
package/lib/types.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogLevel = void 0;
|
|
4
|
-
var LogLevel;
|
|
5
|
-
(function (LogLevel) {
|
|
6
|
-
LogLevel["Debug"] = "debug";
|
|
7
|
-
LogLevel["Info"] = "info";
|
|
8
|
-
LogLevel["Warn"] = "warn";
|
|
9
|
-
LogLevel["Error"] = "error";
|
|
10
|
-
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogLevel = void 0;
|
|
4
|
+
var LogLevel;
|
|
5
|
+
(function (LogLevel) {
|
|
6
|
+
LogLevel["Debug"] = "debug";
|
|
7
|
+
LogLevel["Info"] = "info";
|
|
8
|
+
LogLevel["Warn"] = "warn";
|
|
9
|
+
LogLevel["Error"] = "error";
|
|
10
|
+
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
|
|
11
11
|
//# sourceMappingURL=types.js.map
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAgBA,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EALW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAKnB"}
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILogger, Metadata } from '.';
|
|
2
|
-
export declare function consoleLogger(name?: string, options?: {
|
|
3
|
-
metadata?: Metadata;
|
|
4
|
-
}): ILogger;
|
|
1
|
+
import { ILogger, Metadata } from '.';
|
|
2
|
+
export declare function consoleLogger(name?: string, options?: {
|
|
3
|
+
metadata?: Metadata;
|
|
4
|
+
}): ILogger;
|
|
5
5
|
//# sourceMappingURL=utils.d.ts.map
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crimson-education/browser-logger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "An abstract logger and reporting utility for browser environments",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepack": "npm run build",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"@datadog/browser-logs": "^4.4.0",
|
|
30
30
|
"@datadog/browser-rum": "^4.4.0",
|
|
31
31
|
"@sentry/react": "^6.17.9",
|
|
32
|
-
"@sentry/tracing": "^6.17.9"
|
|
32
|
+
"@sentry/tracing": "^6.17.9",
|
|
33
|
+
"aws-amplify": "^4.3.15"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@crimson-education/eslint-config": "^2.1.0",
|