@crimson-education/browser-logger 5.0.1-beta.3 → 5.0.1-beta.4

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.
Files changed (68) hide show
  1. package/README.md +127 -73
  2. package/lib/index.d.ts +1 -1
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +47 -19
  5. package/lib/index.js.map +1 -1
  6. package/lib/logger/consoleTransport.d.ts +1 -1
  7. package/lib/logger/consoleTransport.d.ts.map +1 -1
  8. package/lib/logger/consoleTransport.js +22 -16
  9. package/lib/logger/consoleTransport.js.map +1 -1
  10. package/lib/logger/datadogTransport.d.ts +1 -1
  11. package/lib/logger/datadogTransport.d.ts.map +1 -1
  12. package/lib/logger/datadogTransport.js +8 -4
  13. package/lib/logger/datadogTransport.js.map +1 -1
  14. package/lib/logger/index.js +49 -29
  15. package/lib/logger/index.js.map +1 -1
  16. package/lib/logger/index.test.js +18 -16
  17. package/lib/logger/index.test.js.map +1 -1
  18. package/lib/logger/utils.js +9 -4
  19. package/lib/logger/utils.js.map +1 -1
  20. package/lib/reporters/amplifyReporter.d.ts +86 -0
  21. package/lib/reporters/amplifyReporter.d.ts.map +1 -0
  22. package/lib/reporters/amplifyReporter.js +225 -0
  23. package/lib/reporters/amplifyReporter.js.map +1 -0
  24. package/lib/reporters/amplifyReporter.test.d.ts +2 -0
  25. package/lib/reporters/amplifyReporter.test.d.ts.map +1 -0
  26. package/lib/reporters/amplifyReporter.test.js +51 -0
  27. package/lib/reporters/amplifyReporter.test.js.map +1 -0
  28. package/lib/reporters/datadogReporter.d.ts +1 -13
  29. package/lib/reporters/datadogReporter.d.ts.map +1 -1
  30. package/lib/reporters/datadogReporter.js +49 -122
  31. package/lib/reporters/datadogReporter.js.map +1 -1
  32. package/lib/reporters/gtmReporter.d.ts +1 -1
  33. package/lib/reporters/gtmReporter.d.ts.map +1 -1
  34. package/lib/reporters/gtmReporter.js +5 -1
  35. package/lib/reporters/gtmReporter.js.map +1 -1
  36. package/lib/reporters/index.js +71 -46
  37. package/lib/reporters/index.js.map +1 -1
  38. package/lib/reporters/logReporter.js +34 -24
  39. package/lib/reporters/logReporter.js.map +1 -1
  40. package/lib/reporters/posthogReporter.d.ts +51 -0
  41. package/lib/reporters/posthogReporter.d.ts.map +1 -0
  42. package/lib/reporters/posthogReporter.js +254 -0
  43. package/lib/reporters/posthogReporter.js.map +1 -0
  44. package/lib/reporters/posthogReporter.test.d.ts +2 -0
  45. package/lib/reporters/posthogReporter.test.d.ts.map +1 -0
  46. package/lib/reporters/posthogReporter.test.js +197 -0
  47. package/lib/reporters/posthogReporter.test.js.map +1 -0
  48. package/lib/types/index.js +18 -2
  49. package/lib/types/index.js.map +1 -1
  50. package/lib/types/logger.d.ts +3 -3
  51. package/lib/types/logger.d.ts.map +1 -1
  52. package/lib/types/logger.js +5 -2
  53. package/lib/types/logger.js.map +1 -1
  54. package/lib/types/reporter.d.ts +20 -6
  55. package/lib/types/reporter.d.ts.map +1 -1
  56. package/lib/types/reporter.js +2 -1
  57. package/lib/utils.js +5 -1
  58. package/lib/utils.js.map +1 -1
  59. package/lib/utils.test.js +4 -2
  60. package/lib/utils.test.js.map +1 -1
  61. package/package.json +17 -11
  62. package/src/index.ts +11 -0
  63. package/src/reporters/amplifyReporter.test.ts +61 -0
  64. package/src/reporters/amplifyReporter.ts +344 -0
  65. package/src/reporters/datadogReporter.ts +22 -133
  66. package/src/reporters/posthogReporter.test.ts +244 -0
  67. package/src/reporters/posthogReporter.ts +374 -0
  68. package/src/types/reporter.ts +16 -0
package/README.md CHANGED
@@ -6,11 +6,6 @@ This library contains a number of reporters that is will send analytics to.
6
6
 
7
7
  These must be enabled by calling `Logger.init()`, as seen below.
8
8
 
9
- > **Note**: This library has been upgraded to support Node.js 22. Some features have been removed or modified during the upgrade process. See the [Upgrade Notes](#upgrade-notes) section for details.
10
-
11
- **!!IMPORTANT NOTICE: for the legacy lib of Datadog V4.X and others, please see the main branch, this is the one upgraded.**
12
-
13
-
14
9
  ## Install
15
10
 
16
11
  ```bash
@@ -33,10 +28,11 @@ import { config } from '../configuration';
33
28
 
34
29
  Logger.init({
35
30
  service: 'test-project',
31
+ application: 'crimson-app',
36
32
  environment: config.environment,
37
33
  version: config.version,
38
34
  defaultMetadata: {
39
- application: 'test',
35
+ domain: window.location.hostname,
40
36
  },
41
37
 
42
38
  reporters: {
@@ -58,10 +54,28 @@ Logger.init({
58
54
  logTransport: {
59
55
  level: Logger.LogLevel.Info,
60
56
  },
61
- trackUserInteractions: true,
62
- allowedTrackingOrigins: ['https://my.api.domain'],
57
+ trackInteractions: true,
58
+ trackFrustrations: true,
59
+ allowedTracingOrigins: ['https://my.api.domain']
63
60
  },
64
- },
61
+
62
+ posthog: {
63
+ apiKey: config.posthogApiKey,
64
+ apiHost: config.posthogApiHost,
65
+ capturePageview: 'history_change',
66
+ replaySampleRate: 0,
67
+ },
68
+
69
+ amplify: {
70
+ region: config.awsRegion,
71
+ identityPoolId: config.pinpointIdentityPoolId,
72
+ analyticsAppId: config.pinpointAnalyticsAppId,
73
+
74
+ autoTrackEvents: true,
75
+ autoTrackPageViews: true,
76
+ autoTrackSessions: true,
77
+ }
78
+ }
65
79
  });
66
80
 
67
81
  Logger.setUser({
@@ -98,6 +112,7 @@ Global metadata about the service will be added for transport usage after callin
98
112
 
99
113
  You can add more Global Metadata at any time by calling `addMetadata()`.
100
114
 
115
+
101
116
  ```ts
102
117
  export const logger = Logger.createLogger();
103
118
 
@@ -126,7 +141,7 @@ E.g. On calls
126
141
  Logger.trackEvent({
127
142
  message: 'my-event',
128
143
  toReporters: ['log', 'datadog'],
129
- excludeReporters: ['datadog'],
144
+ excludeReporters: ['datadog']
130
145
  });
131
146
  ```
132
147
 
@@ -158,9 +173,13 @@ You can use `.` to traverse metadata.
158
173
  Logger.init({
159
174
  reporters: {
160
175
  log: {
161
- ignoreMetadataPatterns: ['internalError', 'user.email', /error\.stack.*/g],
162
- },
163
- },
176
+ ignoreMetadataPatterns: [
177
+ 'internalError',
178
+ 'user.email',
179
+ /error\.stack.*/g
180
+ ]
181
+ }
182
+ }
164
183
  });
165
184
  ```
166
185
 
@@ -209,9 +228,9 @@ Logger.init({
209
228
  endpoints: {
210
229
  recordSession: false,
211
230
  recordSessionStop: false,
212
- },
213
- },
214
- },
231
+ }
232
+ }
233
+ }
215
234
  });
216
235
  ```
217
236
 
@@ -241,10 +260,10 @@ Logger.init({
241
260
  logTransport: {
242
261
  level: Logger.LogLevel.Info,
243
262
  },
244
- trackUserInteractions: true,
245
- allowedTrackingOrigins: ['https://my.api.domain'],
246
- },
247
- },
263
+ trackInteractions: true,
264
+ allowedTracingOrigins: ['https://my.api.domain']
265
+ }
266
+ }
248
267
  });
249
268
  ```
250
269
 
@@ -252,6 +271,89 @@ Check out the [`DatadogReporterConfig`](https://github.com/crimson-education/bro
252
271
 
253
272
  This automatically adds a Datadog Log Transport that transmits Log data to Datadog, this can be customized in `DatadogReporterConfig` with `logTransport`, or disabled by setting `logTransport` to `false`.
254
273
 
274
+ #### PostHog
275
+
276
+ To configure PostHog, this requires at least `apiKey` and `apiHost`.
277
+
278
+ ```ts
279
+ import { config } from '../configuration';
280
+ import * as Logger from '@crimson-education/browser-logger';
281
+
282
+ Logger.init({
283
+ reporters: {
284
+ posthog: {
285
+ apiKey: config.posthogApiKey,
286
+ apiHost: config.posthogApiHost,
287
+ capturePageview: 'history_change',
288
+ replaySampleRate: 0,
289
+ trackViewsManually: false,
290
+ }
291
+ }
292
+ });
293
+ ```
294
+
295
+ `replaySampleRate` is provided as a compatibility alias for existing Datadog-style config. Values less than or equal to `0` disable session recording at startup, while `Logger.recordSession()` can still enable replay later for allowlisted users.
296
+
297
+ When multiple repos write into the same PostHog project, prefer setting `application` at `Logger.init(...)`. This ensures a stable product-level dimension is present on all events independently of each app's `service` name.
298
+
299
+ #### Amplify/Pinpoint
300
+
301
+ To configure Amplify, this requires at least `region`, `identityPoolId` and `analyticsAppId`.
302
+
303
+ > **Note**: If you are setting up Browser Logger in a project that uses AWS Cognito or other AWS Amplify Features, you will want to set `identityPoolId` to false. This disables the reporter's call to Auth.configure, as you will have used that to configure your App already.
304
+ >
305
+ > You will need to set identityPoolId in your Auth.configure function yourself, otherwise Pinpoint won't work.
306
+
307
+ Auto `Auth.configure`:
308
+ ```ts
309
+ import { config } from '../configuration';
310
+ import * as Logger from '@crimson-education/browser-logger';
311
+
312
+ Logger.init({
313
+ reporters: {
314
+ amplify: {
315
+ region: config.amplifyAwsRegion,
316
+ analyticsAppId: config.pinpointAnalyticsAppId,
317
+ identityPoolId: config.amplifyIdentityPoolId,
318
+
319
+ autoTrackEvents: true,
320
+ autoTrackPageViews: true,
321
+ autoTrackSessions: true,
322
+ }
323
+ }
324
+ });
325
+ ```
326
+
327
+ Manual `Auth.configure`:
328
+ ```ts
329
+ import { Auth } from '@aws-amplify/auth';
330
+ import { config } from '../configuration';
331
+ import * as Logger from '@crimson-education/browser-logger';
332
+
333
+ Auth.configure({
334
+ region: config.cognitoRegion,
335
+ userPoolId: config.cognitoUserPoolId,
336
+ userPoolWebClientId: config.cognitoClientId,
337
+ identityPoolId: config.amplifyIdentityPoolId,
338
+ });
339
+
340
+ Logger.init({
341
+ reporters: {
342
+ amplify: {
343
+ region: config.amplifyAwsRegion,
344
+ analyticsAppId: config.pinpointAnalyticsAppId,
345
+ identityPoolId: false,
346
+
347
+ autoTrackEvents: true,
348
+ autoTrackPageViews: true,
349
+ autoTrackSessions: true,
350
+ }
351
+ }
352
+ });
353
+ ```
354
+
355
+ Check out the [`AmplifyReporterConfig`](https://github.com/crimson-education/browser-logger/blob/main/src/reporters/amplifyReporter.ts) for all of the configuration you can apply to Amplify reporting.
356
+
255
357
  #### Google Tag Manager
256
358
 
257
359
  To configure GTM, you will need to have loaded the GTM script into your App.
@@ -265,16 +367,16 @@ import * as Logger from '@crimson-education/browser-logger';
265
367
  Logger.init({
266
368
  reporters: {
267
369
  gtm: true,
268
- },
370
+ }
269
371
  });
270
372
 
271
373
  // With configuration
272
374
  Logger.init({
273
375
  reporters: {
274
376
  gtm: {
275
- ignoreBreadcrumbCategories: ['fetch'],
276
- },
277
- },
377
+ ignoreBreadcrumbCategories: ['fetch']
378
+ }
379
+ }
278
380
  });
279
381
  ```
280
382
 
@@ -287,7 +389,7 @@ See the [src/reporter/index.ts](./src/reporter/index.ts) file for all exported f
287
389
 
288
390
  ### Improve Session Tracking with Component names
289
391
 
290
- You can improve the name of components in analytics tools like Datadog, instead of using the content of a component.
392
+ You can improve the name of components in analytics tools like Datadog and Amplify use, instead of the content of a component.
291
393
  This is valuable if the content is dynamic, e.g. a user's name:
292
394
 
293
395
  ```jsx
@@ -295,51 +397,3 @@ This is valuable if the content is dynamic, e.g. a user's name:
295
397
  ```
296
398
 
297
399
  This will result in the session saying something like, **clicked on "MyUserName"**.
298
-
299
- ## Upgrade Notes
300
-
301
- ### Node.js 22 Upgrade Changes
302
-
303
- This library has been upgraded to support Node.js 22. The following changes were made during the upgrade process:
304
-
305
- #### Datadog Reporter Changes
306
-
307
- - `trackInteractions` → `trackUserInteractions` (renamed for clarity)
308
- - `trackFrustrations` → Removed (replaced with custom frustration detection implementation)
309
- - `allowedTracingOrigins` → `allowedTrackingOrigins` (corrected spelling)
310
-
311
- #### Removed Features
312
-
313
- The following features were removed during the upgrade and have been replaced with custom implementations:
314
-
315
- 1. **Automatic Frustration Detection**: Replaced with custom implementation that detects:
316
- - Rapid clicks (potential frustration)
317
- - Form validation errors
318
- - 404 and network errors
319
-
320
- 2. **Enhanced Auto-tracking**: Replaced with custom implementation that tracks:
321
- - Page views and route changes
322
- - User interactions with analytics-enabled elements
323
- - Session state changes (active/inactive)
324
-
325
- #### Configuration Updates Required
326
-
327
- If you're upgrading from a previous version, update your configuration:
328
-
329
- ```ts
330
- // Old configuration
331
- datadog: {
332
- trackInteractions: true,
333
- trackFrustrations: true,
334
- allowedTracingOrigins: ['https://my.api.domain']
335
- }
336
-
337
- // New configuration
338
- datadog: {
339
- trackUserInteractions: true,
340
- allowedTrackingOrigins: ['https://my.api.domain']
341
- // trackFrustrations is now handled automatically
342
- }
343
- ```
344
-
345
- For more details about the upgrade process and custom implementations, see the individual reporter configuration files.
package/lib/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ReporterConfigurations, ServiceInfo } from './types';
2
2
  export * from './types';
3
3
  export * from './reporters';
4
4
  export * from './logger';
5
- export type LoggerConfig = ServiceInfo & {
5
+ export declare type LoggerConfig = ServiceInfo & {
6
6
  reporters?: ReporterConfigurations;
7
7
  };
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAO9D,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AAEzB,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IAAE,SAAS,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAIhF;;;GAGG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,YAAY,QAuCxC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAS9D,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AAEzB,oBAAY,YAAY,GAAG,WAAW,GAAG;IAAE,SAAS,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAIhF;;;GAGG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,YAAY,QAgDxC"}
package/lib/index.js CHANGED
@@ -1,47 +1,75 @@
1
- import { setLogLevel } from './logger';
2
- import { addMetadata, reporters, setEventLevel } from './reporters';
3
- import { gtmReporter } from './reporters/gtmReporter';
4
- import { datadogReporter } from './reporters/datadogReporter';
5
- import { logReporter } from './reporters/logReporter';
6
- export * from './types';
7
- export * from './reporters';
8
- export * from './logger';
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.init = void 0;
18
+ const logger_1 = require("./logger");
19
+ const reporters_1 = require("./reporters");
20
+ const gtmReporter_1 = require("./reporters/gtmReporter");
21
+ const amplifyReporter_1 = require("./reporters/amplifyReporter");
22
+ const datadogReporter_1 = require("./reporters/datadogReporter");
23
+ const logReporter_1 = require("./reporters/logReporter");
24
+ const posthogReporter_1 = require("./reporters/posthogReporter");
25
+ __exportStar(require("./types"), exports);
26
+ __exportStar(require("./reporters"), exports);
27
+ __exportStar(require("./logger"), exports);
9
28
  let initialized = false;
10
29
  /**
11
30
  * Initializes the logger and reporters.
12
31
  * @param config Reporter config options.
13
32
  */
14
- export function init(config) {
33
+ function init(config) {
34
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
15
35
  // Some reporters don't like being initialized multiple times.
16
36
  if (initialized) {
17
37
  return;
18
38
  }
19
39
  initialized = true;
20
40
  // Log Reporter enabled by default.
21
- const logReporterConfig = config.reporters?.log ?? true;
41
+ const logReporterConfig = (_b = (_a = config.reporters) === null || _a === void 0 ? void 0 : _a.log) !== null && _b !== void 0 ? _b : true;
22
42
  if (logReporterConfig !== false) {
23
- reporters['log'] = logReporter(config, typeof logReporterConfig === 'boolean' ? {} : logReporterConfig);
43
+ reporters_1.reporters['log'] = (0, logReporter_1.logReporter)(config, typeof logReporterConfig === 'boolean' ? {} : logReporterConfig);
44
+ }
45
+ if ((_c = config.reporters) === null || _c === void 0 ? void 0 : _c.datadog) {
46
+ reporters_1.reporters['datadog'] = (0, datadogReporter_1.datadogReporter)(config, config.reporters.datadog);
47
+ }
48
+ if ((_d = config.reporters) === null || _d === void 0 ? void 0 : _d.amplify) {
49
+ reporters_1.reporters['amplify'] = (0, amplifyReporter_1.amplifyReporter)(config, config.reporters.amplify);
24
50
  }
25
- if (config.reporters?.datadog) {
26
- reporters['datadog'] = datadogReporter(config, config.reporters.datadog);
51
+ if ((_e = config.reporters) === null || _e === void 0 ? void 0 : _e.posthog) {
52
+ reporters_1.reporters['posthog'] = (0, posthogReporter_1.posthogReporter)(config, config.reporters.posthog);
27
53
  }
28
- if (config.reporters?.gtm) {
29
- reporters['gtm'] = gtmReporter(config, typeof config.reporters.gtm === 'boolean' ? {} : config.reporters.gtm);
54
+ if ((_f = config.reporters) === null || _f === void 0 ? void 0 : _f.gtm) {
55
+ reporters_1.reporters['gtm'] = (0, gtmReporter_1.gtmReporter)(config, typeof config.reporters.gtm === 'boolean' ? {} : config.reporters.gtm);
30
56
  }
31
57
  const defaultMetadata = {
32
- ...(config.defaultMetadata ?? {}),
58
+ ...((_g = config.defaultMetadata) !== null && _g !== void 0 ? _g : {}),
59
+ application: (_h = config.application) !== null && _h !== void 0 ? _h : (_j = config.defaultMetadata) === null || _j === void 0 ? void 0 : _j.application,
33
60
  service: config.service,
34
61
  environment: config.environment,
35
62
  version: config.version,
36
63
  };
37
64
  // Sets the global log level, if specified.
38
65
  if (config.logLevel) {
39
- setLogLevel(config.logLevel);
66
+ (0, logger_1.setLogLevel)(config.logLevel);
40
67
  }
41
68
  // Sets the global event level, if specified.
42
69
  if (config.eventLevel) {
43
- setEventLevel(config.eventLevel);
70
+ (0, reporters_1.setEventLevel)(config.eventLevel);
44
71
  }
45
- addMetadata(defaultMetadata);
72
+ (0, reporters_1.addMetadata)(defaultMetadata);
46
73
  }
74
+ exports.init = init;
47
75
  //# 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":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AAIzB,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,MAAoB;IACvC,8DAA8D;IAC9D,IAAI,WAAW,EAAE;QACf,OAAO;KACR;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,mCAAmC;IACnC,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,IAAI,IAAI,CAAC;IACxD,IAAI,iBAAiB,KAAK,KAAK,EAAE;QAC/B,SAAS,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;KACzG;IAED,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE;QAC7B,SAAS,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KAC1E;IAED,IAAI,MAAM,CAAC,SAAS,E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,2CAA2C;IAC3C,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,IAAA,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;AAhDD,oBAgDC"}
@@ -14,7 +14,7 @@ declare const colors: {
14
14
  red: number[];
15
15
  yellow: number[];
16
16
  };
17
- export type ColorizeColor = keyof typeof colors;
17
+ export declare type ColorizeColor = keyof typeof colors;
18
18
  /**
19
19
  * Colorize a string with a specified color.
20
20
  * @param str String to colorize
@@ -1 +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,MAAM,MAAM,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"}
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"}
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.consoleTransport = exports.colorize = void 0;
1
4
  // from browser-util-inspect
2
5
  const colors = {
3
6
  bold: [1, 22],
@@ -20,37 +23,39 @@ const colors = {
20
23
  * @param color Color to colorize the string with
21
24
  * @returns Colorized string
22
25
  */
23
- export function colorize(str, color) {
26
+ function colorize(str, color) {
24
27
  const colorData = colors[color];
25
28
  return '\u001b[' + colorData[0] + 'm' + str + '\u001b[' + colorData[1] + 'm';
26
29
  }
30
+ exports.colorize = colorize;
27
31
  /**
28
32
  * Gets a stack trace from metadata or accompanying error.
29
33
  */
30
34
  function getStackTrace(data) {
31
- const stack = data?.err?.stack || data.stack || data['error.stack'];
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'];
32
37
  delete data.stack;
33
- return stack ?? '';
38
+ return stack !== null && stack !== void 0 ? stack : '';
34
39
  }
35
- export function consoleTransport(config = {}) {
40
+ function consoleTransport(config = {}) {
41
+ var _a, _b, _c;
36
42
  // Default ignore patterns
37
- config.ignoreMetadataPatterns ??= ['application', 'service', 'environment', 'version'];
43
+ (_a = config.ignoreMetadataPatterns) !== null && _a !== void 0 ? _a : (config.ignoreMetadataPatterns = ['application', 'service', 'environment', 'version']);
38
44
  // Get the colorizer function, or a no-op if not enabled.
39
- const colorizer = config.colorize !== false ? config.colorize ?? colorize : (str) => str;
45
+ const colorizer = config.colorize !== false ? (_b = config.colorize) !== null && _b !== void 0 ? _b : colorize : (str) => str;
40
46
  // Get the log level color function, or use the default colors.
41
- const getLogLevelColor = config.getLogLevelColor ??
42
- ((level) => {
43
- return {
44
- error: 'red',
45
- warn: 'yellow',
46
- info: 'cyan',
47
- debug: 'green',
48
- }[level];
49
- });
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
+ });
50
55
  const transport = {
51
56
  ...config,
52
57
  log: ({ level, message, timestamp, splat, ...metadata }) => {
53
- let splatData = splat ?? [];
58
+ let splatData = splat !== null && splat !== void 0 ? splat : [];
54
59
  const stackTrace = getStackTrace(metadata);
55
60
  const strippedInfo = { ...metadata };
56
61
  delete strippedInfo['level'];
@@ -72,4 +77,5 @@ export function consoleTransport(config = {}) {
72
77
  };
73
78
  return transport;
74
79
  }
80
+ exports.consoleTransport = consoleTransport;
75
81
  //# sourceMappingURL=consoleTransport.js.map
@@ -1 +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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C,OAAO,CAAC,CAAC;YAC7B,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;YAC/B,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;YAC7B,OAAO,YAAY,CAAC,WAAW,CAAC,CAAC;YACjC,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;YAE7B,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBACxC,SAAS,GAAG,CAAC,YAAY,EAAE,GAAG,SAAS,CAAC,CAAC;aAC1C;YAED,IAAI,OAAO,EAAE;gBACX,SAAS,GAAG,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,CAAC;aACrC;YAED,IAAI,UAAU,EAAE;gBACd,SAAS,GAAG,CAAC,GAAG,SAAS,EAAE,UAAU,CAAC,CAAC;aACxC;YAED,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC;QACjH,CAAC;KACF,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAhDD,4CAgDC"}
@@ -1,5 +1,5 @@
1
1
  import { ILogTransport, LogTransportConfigBase } from '../types';
2
- export type DatadogLogTransportConfig = LogTransportConfigBase;
2
+ export declare type DatadogLogTransportConfig = LogTransportConfigBase;
3
3
  /**
4
4
  * A transport that sends logs to Datadog.
5
5
  * Note: This requires the datadog reporter to be initialized for it to work.
@@ -1 +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,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,yBAA8B,iBAStE"}
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"}
@@ -1,17 +1,21 @@
1
- import { getLogMessage } from './utils';
2
- import { datadogLogs } from '@datadog/browser-logs';
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");
3
6
  /**
4
7
  * A transport that sends logs to Datadog.
5
8
  * Note: This requires the datadog reporter to be initialized for it to work.
6
9
  */
7
- export function datadogTransport(config = {}) {
10
+ function datadogTransport(config = {}) {
8
11
  const transport = {
9
12
  ...config,
10
13
  log: ({ level, message, ...metadata }) => {
11
14
  // Datadog expects a string message.
12
- datadogLogs.logger[level](getLogMessage(message), metadata);
15
+ browser_logs_1.datadogLogs.logger[level]((0, utils_1.getLogMessage)(message), metadata);
13
16
  },
14
17
  };
15
18
  return transport;
16
19
  }
20
+ exports.datadogTransport = datadogTransport;
17
21
  //# sourceMappingURL=datadogTransport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"datadogTransport.js","sourceRoot":"","sources":["../../src/logger/datadogTransport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD;;;GAGG;AACH,MAAM,UAAU,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,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC9D,CAAC;KACF,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC"}
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"}