@crimson-education/browser-logger 1.5.0 → 1.5.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 CHANGED
@@ -1,30 +1,30 @@
1
- import { ILogger, Metadata, ReportError, ReportUser, ServiceInfo } from './types';
2
- import { ReporterBreadcrumb, ReporterEvent, TrackedReporterEvent } from './reporters';
3
- import { DatadogReporterConfig } from './reporters/datadogReporter';
4
- import { SentryReporterConfig } from './reporters/sentryReporter';
5
- import { AmplifyReporterConfig } from './reporters/amplifyReporter';
6
- export * from './types';
7
- export declare let logger: ILogger | null;
8
- export declare type ReporterConfig = ServiceInfo & {
9
- sentry?: SentryReporterConfig;
10
- datadog?: DatadogReporterConfig;
11
- amplify?: AmplifyReporterConfig;
12
- gtm?: boolean;
13
- newrelic?: boolean;
14
- };
15
- export declare function init(config: ReporterConfig): void;
16
- export declare function trackEvent(event: ReporterEvent): void;
17
- export declare function addBreadcrumb(breadcrumb: ReporterBreadcrumb): void;
18
- export declare function addMetadata(metadata: Metadata): void;
19
- export declare function setUser(user: ReportUser | null): void;
20
- export declare function setRouteName(routeName: string): void;
21
- export declare function setPageName(pageName: string): void;
22
- export declare function reportError(error: ReportError, metadata?: Metadata): void;
23
- export declare function recordSession(): void;
24
- export declare function recordSessionStop(): void;
25
- export declare function trackEventSinceLastAction(event: ReporterEvent): void;
26
- export declare function getLastTrackedEvent(): TrackedReporterEvent | null;
27
- export declare function createLogger(name?: string, options?: {
28
- metadata?: Metadata;
29
- }): ILogger;
1
+ import { ILogger, Metadata, ReportError, ReportUser, ServiceInfo } from './types';
2
+ import { ReporterBreadcrumb, ReporterEvent, TrackedReporterEvent } from './reporters';
3
+ import { DatadogReporterConfig } from './reporters/datadogReporter';
4
+ import { SentryReporterConfig } from './reporters/sentryReporter';
5
+ import { AmplifyReporterConfig } from './reporters/amplifyReporter';
6
+ export * from './types';
7
+ export declare let logger: ILogger | null;
8
+ export declare type ReporterConfig = ServiceInfo & {
9
+ sentry?: SentryReporterConfig;
10
+ datadog?: DatadogReporterConfig;
11
+ amplify?: AmplifyReporterConfig;
12
+ gtm?: boolean;
13
+ newrelic?: boolean;
14
+ };
15
+ export declare function init(config: ReporterConfig): void;
16
+ export declare function trackEvent(event: ReporterEvent): void;
17
+ export declare function addBreadcrumb(breadcrumb: ReporterBreadcrumb): void;
18
+ export declare function addMetadata(metadata: Metadata): void;
19
+ export declare function setUser(user: ReportUser | null): void;
20
+ export declare function setRouteName(routeName: string): void;
21
+ export declare function setPageName(pageName: string): void;
22
+ export declare function reportError(error: ReportError, metadata?: Metadata): void;
23
+ export declare function recordSession(): void;
24
+ export declare function recordSessionStop(): void;
25
+ export declare function trackEventSinceLastAction(event: ReporterEvent): void;
26
+ export declare function getLastTrackedEvent(): TrackedReporterEvent | null;
27
+ export declare function createLogger(name?: string, options?: {
28
+ metadata?: Metadata;
29
+ }): ILogger;
30
30
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,145 +1,149 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.createLogger = exports.getLastTrackedEvent = exports.trackEventSinceLastAction = exports.recordSessionStop = exports.recordSession = exports.reportError = exports.setPageName = exports.setRouteName = exports.setUser = exports.addMetadata = exports.addBreadcrumb = exports.trackEvent = exports.init = exports.logger = void 0;
14
- const utils_1 = require("./utils");
15
- const datadogReporter_1 = require("./reporters/datadogReporter");
16
- const sentryReporter_1 = require("./reporters/sentryReporter");
17
- const gtmReporter_1 = require("./reporters/gtmReporter");
18
- const newrelicReporter_1 = require("./reporters/newrelicReporter");
19
- const amplifyReporter_1 = require("./reporters/amplifyReporter");
20
- __exportStar(require("./types"), exports);
21
- exports.logger = null;
22
- const reporters = [];
23
- let initialized = false;
24
- let ddInitialized = false;
25
- function init(config) {
26
- initialized = true;
27
- if (config.sentry) {
28
- reporters.push(sentryReporter_1.sentryReporter(config, config.sentry));
29
- }
30
- if (config.datadog) {
31
- reporters.push(datadogReporter_1.datadogReporter(config, config.datadog));
32
- ddInitialized = true;
33
- }
34
- if (config.amplify) {
35
- reporters.push(amplifyReporter_1.amplifyReporter(config, config.amplify));
36
- }
37
- if (config.gtm) {
38
- reporters.push(gtmReporter_1.gtmReporter());
39
- }
40
- if (config.newrelic) {
41
- reporters.push(newrelicReporter_1.newrelicReporter(config));
42
- }
43
- if (config.defaultMetadata) {
44
- for (const reporter of reporters) {
45
- reporter.addMetadata(config.defaultMetadata);
46
- }
47
- }
48
- exports.logger = createLogger('Reporter');
49
- }
50
- exports.init = init;
51
- function trackEvent(event) {
52
- for (const reporter of reporters) {
53
- reporter.trackEvent(event);
54
- }
55
- }
56
- exports.trackEvent = trackEvent;
57
- function addBreadcrumb(breadcrumb) {
58
- for (const reporter of reporters) {
59
- reporter.addBreadcrumb(breadcrumb);
60
- }
61
- }
62
- exports.addBreadcrumb = addBreadcrumb;
63
- function addMetadata(metadata) {
64
- for (const reporter of reporters) {
65
- reporter.addMetadata(metadata);
66
- }
67
- }
68
- exports.addMetadata = addMetadata;
69
- function setUser(user) {
70
- for (const reporter of reporters) {
71
- reporter.setUser(user);
72
- }
73
- }
74
- exports.setUser = setUser;
75
- function setRouteName(routeName) {
76
- for (const reporter of reporters) {
77
- reporter.setRouteName(routeName);
78
- }
79
- }
80
- exports.setRouteName = setRouteName;
81
- function setPageName(pageName) {
82
- for (const reporter of reporters) {
83
- reporter.setPageName(pageName);
84
- }
85
- }
86
- exports.setPageName = setPageName;
87
- function reportError(error, metadata) {
88
- for (const reporter of reporters) {
89
- reporter.reportError(error, metadata);
90
- }
91
- }
92
- exports.reportError = reportError;
93
- function recordSession() {
94
- for (const reporter of reporters) {
95
- reporter.recordSession();
96
- }
97
- }
98
- exports.recordSession = recordSession;
99
- function recordSessionStop() {
100
- for (const reporter of reporters) {
101
- reporter.recordSessionStop();
102
- }
103
- }
104
- exports.recordSessionStop = recordSessionStop;
105
- function trackEventSinceLastAction(event) {
106
- const lastEvent = getLastTrackedEvent();
107
- if (lastEvent) {
108
- const duration = new Date().getTime() - lastEvent.occurred.getTime();
109
- trackEvent({
110
- ...event,
111
- metadata: {
112
- ...event.metadata,
113
- lastEventName: lastEvent.message,
114
- timeSinceLastEvent: duration,
115
- },
116
- });
117
- }
118
- else {
119
- trackEvent(event);
120
- }
121
- sessionStorage.setItem('loggerLastEvent', JSON.stringify({ ...event, occurred: new Date() }));
122
- }
123
- exports.trackEventSinceLastAction = trackEventSinceLastAction;
124
- function getLastTrackedEvent() {
125
- const eventStr = sessionStorage.getItem('loggerLastEvent');
126
- if (!eventStr)
127
- return null;
128
- const event = JSON.parse(eventStr);
129
- event.occurred = new Date(event.occurred);
130
- return event;
131
- }
132
- exports.getLastTrackedEvent = getLastTrackedEvent;
133
- function createLogger(name, options) {
134
- if (!initialized) {
135
- throw new Error('You must call init on BrowserLogger before creating a logger');
136
- }
137
- if (ddInitialized) {
138
- return datadogReporter_1.datadogLogger(name, options);
139
- }
140
- else {
141
- return utils_1.consoleLogger(name, options);
142
- }
143
- }
144
- exports.createLogger = createLogger;
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.createLogger = exports.getLastTrackedEvent = exports.trackEventSinceLastAction = exports.recordSessionStop = exports.recordSession = exports.reportError = exports.setPageName = exports.setRouteName = exports.setUser = exports.addMetadata = exports.addBreadcrumb = exports.trackEvent = exports.init = exports.logger = void 0;
18
+ const utils_1 = require("./utils");
19
+ const datadogReporter_1 = require("./reporters/datadogReporter");
20
+ const sentryReporter_1 = require("./reporters/sentryReporter");
21
+ const gtmReporter_1 = require("./reporters/gtmReporter");
22
+ const newrelicReporter_1 = require("./reporters/newrelicReporter");
23
+ const amplifyReporter_1 = require("./reporters/amplifyReporter");
24
+ __exportStar(require("./types"), exports);
25
+ exports.logger = null;
26
+ const reporters = [];
27
+ let initialized = false;
28
+ let ddInitialized = false;
29
+ function init(config) {
30
+ initialized = true;
31
+ if (config.sentry) {
32
+ reporters.push((0, sentryReporter_1.sentryReporter)(config, config.sentry));
33
+ }
34
+ if (config.datadog) {
35
+ reporters.push((0, datadogReporter_1.datadogReporter)(config, config.datadog));
36
+ ddInitialized = true;
37
+ }
38
+ if (config.amplify) {
39
+ reporters.push((0, amplifyReporter_1.amplifyReporter)(config, config.amplify));
40
+ }
41
+ if (config.gtm) {
42
+ reporters.push((0, gtmReporter_1.gtmReporter)());
43
+ }
44
+ if (config.newrelic) {
45
+ reporters.push((0, newrelicReporter_1.newrelicReporter)(config));
46
+ }
47
+ if (config.defaultMetadata) {
48
+ for (const reporter of reporters) {
49
+ reporter.addMetadata(config.defaultMetadata);
50
+ }
51
+ }
52
+ exports.logger = createLogger('Reporter');
53
+ }
54
+ exports.init = init;
55
+ function trackEvent(event) {
56
+ for (const reporter of reporters) {
57
+ reporter.trackEvent(event);
58
+ }
59
+ }
60
+ exports.trackEvent = trackEvent;
61
+ function addBreadcrumb(breadcrumb) {
62
+ for (const reporter of reporters) {
63
+ reporter.addBreadcrumb(breadcrumb);
64
+ }
65
+ }
66
+ exports.addBreadcrumb = addBreadcrumb;
67
+ function addMetadata(metadata) {
68
+ for (const reporter of reporters) {
69
+ reporter.addMetadata(metadata);
70
+ }
71
+ }
72
+ exports.addMetadata = addMetadata;
73
+ function setUser(user) {
74
+ for (const reporter of reporters) {
75
+ reporter.setUser(user);
76
+ }
77
+ }
78
+ exports.setUser = setUser;
79
+ function setRouteName(routeName) {
80
+ for (const reporter of reporters) {
81
+ reporter.setRouteName(routeName);
82
+ }
83
+ }
84
+ exports.setRouteName = setRouteName;
85
+ function setPageName(pageName) {
86
+ for (const reporter of reporters) {
87
+ reporter.setPageName(pageName);
88
+ }
89
+ }
90
+ exports.setPageName = setPageName;
91
+ function reportError(error, metadata) {
92
+ for (const reporter of reporters) {
93
+ reporter.reportError(error, metadata);
94
+ }
95
+ }
96
+ exports.reportError = reportError;
97
+ function recordSession() {
98
+ for (const reporter of reporters) {
99
+ reporter.recordSession();
100
+ }
101
+ }
102
+ exports.recordSession = recordSession;
103
+ function recordSessionStop() {
104
+ for (const reporter of reporters) {
105
+ reporter.recordSessionStop();
106
+ }
107
+ }
108
+ exports.recordSessionStop = recordSessionStop;
109
+ function trackEventSinceLastAction(event) {
110
+ const lastEvent = getLastTrackedEvent();
111
+ if (lastEvent) {
112
+ const duration = new Date().getTime() - lastEvent.occurred.getTime();
113
+ trackEvent({
114
+ ...event,
115
+ metadata: {
116
+ ...event.metadata,
117
+ lastEventName: lastEvent.message,
118
+ timeSinceLastEvent: duration,
119
+ },
120
+ });
121
+ }
122
+ else {
123
+ trackEvent(event);
124
+ }
125
+ sessionStorage.setItem('loggerLastEvent', JSON.stringify({ ...event, occurred: new Date() }));
126
+ }
127
+ exports.trackEventSinceLastAction = trackEventSinceLastAction;
128
+ function getLastTrackedEvent() {
129
+ const eventStr = sessionStorage.getItem('loggerLastEvent');
130
+ if (!eventStr)
131
+ return null;
132
+ const event = JSON.parse(eventStr);
133
+ event.occurred = new Date(event.occurred);
134
+ return event;
135
+ }
136
+ exports.getLastTrackedEvent = getLastTrackedEvent;
137
+ function createLogger(name, options) {
138
+ if (!initialized) {
139
+ throw new Error('You must call init on BrowserLogger before creating a logger');
140
+ }
141
+ if (ddInitialized) {
142
+ return (0, datadogReporter_1.datadogLogger)(name, options);
143
+ }
144
+ else {
145
+ return (0, utils_1.consoleLogger)(name, options);
146
+ }
147
+ }
148
+ exports.createLogger = createLogger;
145
149
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,mCAAwC;AACxC,iEAAoG;AACpG,+DAAkF;AAClF,yDAAsD;AACtD,mEAAgE;AAChE,iEAAqF;AAErF,0CAAwB;AAEb,QAAA,MAAM,GAAmB,IAAI,CAAC;AAmBzC,MAAM,SAAS,GAAgB,EAAE,CAAC;AAClC,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,SAAgB,IAAI,CAAC,MAAsB;IACzC,WAAW,GAAG,IAAI,CAAC;IAEnB,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,SAAS,CAAC,IAAI,CAAC,+BAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;KACvD;IAED,IAAI,MAAM,CAAC,OAAO,EAAE;QAClB,SAAS,CAAC,IAAI,CAAC,iCAAe,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACxD,aAAa,GAAG,IAAI,CAAC;KACtB;IAED,IAAI,MAAM,CAAC,OAAO,EAAE;QAClB,SAAS,CAAC,IAAI,CAAC,iCAAe,CAAC,MAAM,EAAE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aAC7B;SACF,CAAC,CAAC;KACJ;SAAM;QACL,UAAU,CAAC,KAAK,CAAC,CAAC;KACnB;IACD,cAAc,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AAChG,CAAC;AAhBD,8DAgBC;AAED,SAAgB,mBAAmB;IACjC,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC3D,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,MAAM,KAAK,GAAyB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzD,KAAK,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,kDAOC;AAED,SAAgB,YAAY,CAAC,IAAa,EAAE,OAAiC;IAC3E,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;KACjF;IAED,IAAI,aAAa,EAAE;QACjB,OAAO,IAAA,+BAAa,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACrC;SAAM;QACL,OAAO,IAAA,qBAAa,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACrC;AACH,CAAC;AAVD,oCAUC"}
@@ -1,44 +1,44 @@
1
- import { IReporter } from '.';
2
- import { ServiceInfo } from '../types';
3
- export declare type AmplifyReporterConfig = {
4
- region: string;
5
- identityPoolId: string;
6
- analyticsAppId: string;
7
- autoTrackPageViews?: boolean;
8
- autoTrackEvents?: boolean;
9
- autoTrackSessions?: boolean;
10
- selectorPrefix?: string;
11
- ignoreBreadcrumbCategories?: string[];
12
- buffering?: AmplifyReporterBufferingConfig;
13
- userPoolId?: string;
14
- userPoolWebClientId?: string;
15
- };
16
- /**
17
- * Configuration options for the buffering behavior of Pinpoint's event tracker.
18
- *
19
- * @see https://docs.amplify.aws/lib/analytics/getting-started/q/platform/js/#set-up-existing-analytics-backend
20
- */
21
- declare type AmplifyReporterBufferingConfig = {
22
- /** Number of items to buffer for sending. */
23
- bufferSize?: number;
24
- /** Number of events sent each time Pinpoint flushes. */
25
- flushSize?: number;
26
- /** Interval Pinpoint flushes analytics events. Measured in milliseconds. */
27
- flushInterval?: number;
28
- /** The maximum number of times Pinpoint will retry to send an event. */
29
- resendLimit?: number;
30
- };
31
- export declare function amplifyReporter(info: ServiceInfo, config: AmplifyReporterConfig): IReporter;
32
- declare type AttributeMap = Record<string, string[] | string | null>;
33
- /**
34
- * Pinpoint has strict attribute name and value length limits
35
- */
36
- export declare function asAttributeMap(values: Record<string, any>, groupValues?: boolean): AttributeMap;
37
- /**
38
- * Pinpoint expects `endpoint.attributes` and `endpoint.userAttributes` to have
39
- * values which are string arrays. This function takes in an object and ensures
40
- * all of its values are of type `string[]` to appease Pinpoint.
41
- */
42
- export declare function buildAttributeMap(values: Record<string, any>, parentKey?: string | undefined, groupValues?: boolean): AttributeMap;
43
- export {};
1
+ import { IReporter } from '.';
2
+ import { ServiceInfo } from '../types';
3
+ export declare type AmplifyReporterConfig = {
4
+ region: string;
5
+ identityPoolId: string;
6
+ analyticsAppId: string;
7
+ autoTrackPageViews?: boolean;
8
+ autoTrackEvents?: boolean;
9
+ autoTrackSessions?: boolean;
10
+ selectorPrefix?: string;
11
+ ignoreBreadcrumbCategories?: string[];
12
+ buffering?: AmplifyReporterBufferingConfig;
13
+ userPoolId?: string;
14
+ userPoolWebClientId?: string;
15
+ };
16
+ /**
17
+ * Configuration options for the buffering behavior of Pinpoint's event tracker.
18
+ *
19
+ * @see https://docs.amplify.aws/lib/analytics/getting-started/q/platform/js/#set-up-existing-analytics-backend
20
+ */
21
+ declare type AmplifyReporterBufferingConfig = {
22
+ /** Number of items to buffer for sending. */
23
+ bufferSize?: number;
24
+ /** Number of events sent each time Pinpoint flushes. */
25
+ flushSize?: number;
26
+ /** Interval Pinpoint flushes analytics events. Measured in milliseconds. */
27
+ flushInterval?: number;
28
+ /** The maximum number of times Pinpoint will retry to send an event. */
29
+ resendLimit?: number;
30
+ };
31
+ export declare function amplifyReporter(info: ServiceInfo, config: AmplifyReporterConfig): IReporter;
32
+ declare type AttributeMap = Record<string, string[] | string | null>;
33
+ /**
34
+ * Pinpoint has strict attribute name and value length limits
35
+ */
36
+ export declare function asAttributeMap(values: Record<string, any>, groupValues?: boolean): AttributeMap;
37
+ /**
38
+ * Pinpoint expects `endpoint.attributes` and `endpoint.userAttributes` to have
39
+ * values which are string arrays. This function takes in an object and ensures
40
+ * all of its values are of type `string[]` to appease Pinpoint.
41
+ */
42
+ export declare function buildAttributeMap(values: Record<string, any>, parentKey?: string | undefined, groupValues?: boolean): AttributeMap;
43
+ export {};
44
44
  //# sourceMappingURL=amplifyReporter.d.ts.map