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

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 (64) hide show
  1. package/README.md +72 -94
  2. package/lib/index.d.ts +1 -1
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +23 -46
  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 +16 -22
  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 +4 -8
  13. package/lib/logger/datadogTransport.js.map +1 -1
  14. package/lib/logger/index.js +29 -49
  15. package/lib/logger/index.js.map +1 -1
  16. package/lib/logger/index.test.js +16 -18
  17. package/lib/logger/index.test.js.map +1 -1
  18. package/lib/logger/utils.js +4 -9
  19. package/lib/logger/utils.js.map +1 -1
  20. package/lib/reporters/datadogReporter.d.ts +13 -1
  21. package/lib/reporters/datadogReporter.d.ts.map +1 -1
  22. package/lib/reporters/datadogReporter.js +122 -49
  23. package/lib/reporters/datadogReporter.js.map +1 -1
  24. package/lib/reporters/gtmReporter.d.ts +1 -1
  25. package/lib/reporters/gtmReporter.d.ts.map +1 -1
  26. package/lib/reporters/gtmReporter.js +1 -5
  27. package/lib/reporters/gtmReporter.js.map +1 -1
  28. package/lib/reporters/index.js +46 -71
  29. package/lib/reporters/index.js.map +1 -1
  30. package/lib/reporters/logReporter.js +24 -34
  31. package/lib/reporters/logReporter.js.map +1 -1
  32. package/lib/reporters/posthogReporter.d.ts +1 -1
  33. package/lib/reporters/posthogReporter.d.ts.map +1 -1
  34. package/lib/reporters/posthogReporter.js +41 -55
  35. package/lib/reporters/posthogReporter.js.map +1 -1
  36. package/lib/reporters/posthogReporter.test.js +15 -22
  37. package/lib/reporters/posthogReporter.test.js.map +1 -1
  38. package/lib/types/index.js +2 -18
  39. package/lib/types/index.js.map +1 -1
  40. package/lib/types/logger.d.ts +3 -3
  41. package/lib/types/logger.d.ts.map +1 -1
  42. package/lib/types/logger.js +2 -5
  43. package/lib/types/logger.js.map +1 -1
  44. package/lib/types/reporter.d.ts +6 -12
  45. package/lib/types/reporter.d.ts.map +1 -1
  46. package/lib/types/reporter.js +1 -2
  47. package/lib/utils.js +1 -5
  48. package/lib/utils.js.map +1 -1
  49. package/lib/utils.test.js +2 -4
  50. package/lib/utils.test.js.map +1 -1
  51. package/package.json +16 -16
  52. package/src/index.ts +0 -6
  53. package/src/reporters/datadogReporter.ts +133 -22
  54. package/src/types/reporter.ts +0 -7
  55. package/lib/reporters/amplifyReporter.d.ts +0 -86
  56. package/lib/reporters/amplifyReporter.d.ts.map +0 -1
  57. package/lib/reporters/amplifyReporter.js +0 -225
  58. package/lib/reporters/amplifyReporter.js.map +0 -1
  59. package/lib/reporters/amplifyReporter.test.d.ts +0 -2
  60. package/lib/reporters/amplifyReporter.test.d.ts.map +0 -1
  61. package/lib/reporters/amplifyReporter.test.js +0 -51
  62. package/lib/reporters/amplifyReporter.test.js.map +0 -1
  63. package/src/reporters/amplifyReporter.test.ts +0 -61
  64. package/src/reporters/amplifyReporter.ts +0 -344
package/README.md CHANGED
@@ -6,6 +6,11 @@ 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
+
9
14
  ## Install
10
15
 
11
16
  ```bash
@@ -54,9 +59,8 @@ Logger.init({
54
59
  logTransport: {
55
60
  level: Logger.LogLevel.Info,
56
61
  },
57
- trackInteractions: true,
58
- trackFrustrations: true,
59
- allowedTracingOrigins: ['https://my.api.domain']
62
+ trackUserInteractions: true,
63
+ allowedTrackingOrigins: ['https://my.api.domain'],
60
64
  },
61
65
 
62
66
  posthog: {
@@ -65,17 +69,7 @@ Logger.init({
65
69
  capturePageview: 'history_change',
66
70
  replaySampleRate: 0,
67
71
  },
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
- }
72
+ },
79
73
  });
80
74
 
81
75
  Logger.setUser({
@@ -112,7 +106,6 @@ Global metadata about the service will be added for transport usage after callin
112
106
 
113
107
  You can add more Global Metadata at any time by calling `addMetadata()`.
114
108
 
115
-
116
109
  ```ts
117
110
  export const logger = Logger.createLogger();
118
111
 
@@ -141,7 +134,7 @@ E.g. On calls
141
134
  Logger.trackEvent({
142
135
  message: 'my-event',
143
136
  toReporters: ['log', 'datadog'],
144
- excludeReporters: ['datadog']
137
+ excludeReporters: ['datadog'],
145
138
  });
146
139
  ```
147
140
 
@@ -173,13 +166,9 @@ You can use `.` to traverse metadata.
173
166
  Logger.init({
174
167
  reporters: {
175
168
  log: {
176
- ignoreMetadataPatterns: [
177
- 'internalError',
178
- 'user.email',
179
- /error\.stack.*/g
180
- ]
181
- }
182
- }
169
+ ignoreMetadataPatterns: ['internalError', 'user.email', /error\.stack.*/g],
170
+ },
171
+ },
183
172
  });
184
173
  ```
185
174
 
@@ -228,9 +217,9 @@ Logger.init({
228
217
  endpoints: {
229
218
  recordSession: false,
230
219
  recordSessionStop: false,
231
- }
232
- }
233
- }
220
+ },
221
+ },
222
+ },
234
223
  });
235
224
  ```
236
225
 
@@ -260,10 +249,10 @@ Logger.init({
260
249
  logTransport: {
261
250
  level: Logger.LogLevel.Info,
262
251
  },
263
- trackInteractions: true,
264
- allowedTracingOrigins: ['https://my.api.domain']
265
- }
266
- }
252
+ trackUserInteractions: true,
253
+ allowedTrackingOrigins: ['https://my.api.domain'],
254
+ },
255
+ },
267
256
  });
268
257
  ```
269
258
 
@@ -295,65 +284,6 @@ Logger.init({
295
284
  `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
285
 
297
286
  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
-
357
287
  #### Google Tag Manager
358
288
 
359
289
  To configure GTM, you will need to have loaded the GTM script into your App.
@@ -367,16 +297,16 @@ import * as Logger from '@crimson-education/browser-logger';
367
297
  Logger.init({
368
298
  reporters: {
369
299
  gtm: true,
370
- }
300
+ },
371
301
  });
372
302
 
373
303
  // With configuration
374
304
  Logger.init({
375
305
  reporters: {
376
306
  gtm: {
377
- ignoreBreadcrumbCategories: ['fetch']
378
- }
379
- }
307
+ ignoreBreadcrumbCategories: ['fetch'],
308
+ },
309
+ },
380
310
  });
381
311
  ```
382
312
 
@@ -389,7 +319,7 @@ See the [src/reporter/index.ts](./src/reporter/index.ts) file for all exported f
389
319
 
390
320
  ### Improve Session Tracking with Component names
391
321
 
392
- You can improve the name of components in analytics tools like Datadog and Amplify use, instead of the content of a component.
322
+ You can improve the name of components in analytics tools like Datadog, instead of using the content of a component.
393
323
  This is valuable if the content is dynamic, e.g. a user's name:
394
324
 
395
325
  ```jsx
@@ -397,3 +327,51 @@ This is valuable if the content is dynamic, e.g. a user's name:
397
327
  ```
398
328
 
399
329
  This will result in the session saying something like, **clicked on "MyUserName"**.
330
+
331
+ ## Upgrade Notes
332
+
333
+ ### Node.js 22 Upgrade Changes
334
+
335
+ This library has been upgraded to support Node.js 22. The following changes were made during the upgrade process:
336
+
337
+ #### Datadog Reporter Changes
338
+
339
+ - `trackInteractions` → `trackUserInteractions` (renamed for clarity)
340
+ - `trackFrustrations` → Removed (replaced with custom frustration detection implementation)
341
+ - `allowedTracingOrigins` → `allowedTrackingOrigins` (corrected spelling)
342
+
343
+ #### Removed Features
344
+
345
+ The following features were removed during the upgrade and have been replaced with custom implementations:
346
+
347
+ 1. **Automatic Frustration Detection**: Replaced with custom implementation that detects:
348
+ - Rapid clicks (potential frustration)
349
+ - Form validation errors
350
+ - 404 and network errors
351
+
352
+ 2. **Enhanced Auto-tracking**: Replaced with custom implementation that tracks:
353
+ - Page views and route changes
354
+ - User interactions with analytics-enabled elements
355
+ - Session state changes (active/inactive)
356
+
357
+ #### Configuration Updates Required
358
+
359
+ If you're upgrading from a previous version, update your configuration:
360
+
361
+ ```ts
362
+ // Old configuration
363
+ datadog: {
364
+ trackInteractions: true,
365
+ trackFrustrations: true,
366
+ allowedTracingOrigins: ['https://my.api.domain']
367
+ }
368
+
369
+ // New configuration
370
+ datadog: {
371
+ trackUserInteractions: true,
372
+ allowedTrackingOrigins: ['https://my.api.domain']
373
+ // trackFrustrations is now handled automatically
374
+ }
375
+ ```
376
+
377
+ 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 declare type LoggerConfig = ServiceInfo & {
5
+ export 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;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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAQ9D,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,QA2CxC"}
package/lib/index.js CHANGED
@@ -1,75 +1,52 @@
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);
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
+ import { posthogReporter } from './reporters/posthogReporter';
7
+ export * from './types';
8
+ export * from './reporters';
9
+ export * from './logger';
28
10
  let initialized = false;
29
11
  /**
30
12
  * Initializes the logger and reporters.
31
13
  * @param config Reporter config options.
32
14
  */
33
- function init(config) {
34
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
15
+ export function init(config) {
35
16
  // Some reporters don't like being initialized multiple times.
36
17
  if (initialized) {
37
18
  return;
38
19
  }
39
20
  initialized = true;
40
21
  // Log Reporter enabled by default.
41
- const logReporterConfig = (_b = (_a = config.reporters) === null || _a === void 0 ? void 0 : _a.log) !== null && _b !== void 0 ? _b : true;
22
+ const logReporterConfig = config.reporters?.log ?? true;
42
23
  if (logReporterConfig !== false) {
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);
24
+ reporters['log'] = logReporter(config, typeof logReporterConfig === 'boolean' ? {} : logReporterConfig);
47
25
  }
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);
26
+ if (config.reporters?.datadog) {
27
+ reporters['datadog'] = datadogReporter(config, config.reporters.datadog);
50
28
  }
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);
29
+ if (config.reporters?.posthog) {
30
+ reporters['posthog'] = posthogReporter(config, config.reporters.posthog);
53
31
  }
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);
32
+ if (config.reporters?.gtm) {
33
+ reporters['gtm'] = gtmReporter(config, typeof config.reporters.gtm === 'boolean' ? {} : config.reporters.gtm);
56
34
  }
57
35
  const 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,
36
+ ...(config.defaultMetadata ?? {}),
37
+ application: config.application ?? config.defaultMetadata?.application,
60
38
  service: config.service,
61
39
  environment: config.environment,
62
40
  version: config.version,
63
41
  };
64
42
  // Sets the global log level, if specified.
65
43
  if (config.logLevel) {
66
- (0, logger_1.setLogLevel)(config.logLevel);
44
+ setLogLevel(config.logLevel);
67
45
  }
68
46
  // Sets the global event level, if specified.
69
47
  if (config.eventLevel) {
70
- (0, reporters_1.setEventLevel)(config.eventLevel);
48
+ setEventLevel(config.eventLevel);
71
49
  }
72
- (0, reporters_1.addMetadata)(defaultMetadata);
50
+ addMetadata(defaultMetadata);
73
51
  }
74
- exports.init = init;
75
52
  //# 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,qCAAuC;AACvC,2CAAoE;AACpE,yDAAsD;AACtD,iEAA8D;AAC9D,iEAA8D;AAC9D,yDAAsD;AACtD,iEAA8D;AAE9D,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AAIzB,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;;GAGG;AACH,SAAgB,IAAI,CAAC,MAAoB;;IACvC,8DAA8D;IAC9D,IAAI,WAAW,EAAE;QACf,OAAO;KACR;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,mCAAmC;IACnC,MAAM,iBAAiB,GAAG,MAAA,MAAA,MAAM,CAAC,SAAS,0CAAE,GAAG,mCAAI,IAAI,CAAC;IACxD,IAAI,iBAAiB,KAAK,KAAK,EAAE;QAC/B,qBAAS,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,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,EAAE,OAAO,EAAE;QAC7B,SAAS,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KAC1E;IACD,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE;QACzB,SAAS,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;KAC/G;IAED,MAAM,eAAe,GAAG;QACtB,GAAG,CAAC,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC;QACjC,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,eAAe,EAAE,WAAW;QACtE,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;IAEF,2CAA2C;IAC3C,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;KAC9B;IAED,6CAA6C;IAC7C,IAAI,MAAM,CAAC,UAAU,EAAE;QACrB,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KAClC;IAED,WAAW,CAAC,eAAe,CAAC,CAAC;AAC/B,CAAC"}
@@ -14,7 +14,7 @@ declare const colors: {
14
14
  red: number[];
15
15
  yellow: number[];
16
16
  };
17
- export declare type ColorizeColor = keyof typeof colors;
17
+ export 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,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
+ {"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,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.consoleTransport = exports.colorize = void 0;
4
1
  // from browser-util-inspect
5
2
  const colors = {
6
3
  bold: [1, 22],
@@ -23,39 +20,37 @@ const colors = {
23
20
  * @param color Color to colorize the string with
24
21
  * @returns Colorized string
25
22
  */
26
- function colorize(str, color) {
23
+ export function colorize(str, color) {
27
24
  const colorData = colors[color];
28
25
  return '\u001b[' + colorData[0] + 'm' + str + '\u001b[' + colorData[1] + 'm';
29
26
  }
30
- exports.colorize = colorize;
31
27
  /**
32
28
  * Gets a stack trace from metadata or accompanying error.
33
29
  */
34
30
  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'];
31
+ const stack = data?.err?.stack || data.stack || data['error.stack'];
37
32
  delete data.stack;
38
- return stack !== null && stack !== void 0 ? stack : '';
33
+ return stack ?? '';
39
34
  }
40
- function consoleTransport(config = {}) {
41
- var _a, _b, _c;
35
+ export function consoleTransport(config = {}) {
42
36
  // Default ignore patterns
43
- (_a = config.ignoreMetadataPatterns) !== null && _a !== void 0 ? _a : (config.ignoreMetadataPatterns = ['application', 'service', 'environment', 'version']);
37
+ config.ignoreMetadataPatterns ??= ['application', 'service', 'environment', 'version'];
44
38
  // 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;
39
+ const colorizer = config.colorize !== false ? config.colorize ?? colorize : (str) => str;
46
40
  // 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
- });
41
+ const getLogLevelColor = config.getLogLevelColor ??
42
+ ((level) => {
43
+ return {
44
+ error: 'red',
45
+ warn: 'yellow',
46
+ info: 'cyan',
47
+ debug: 'green',
48
+ }[level];
49
+ });
55
50
  const transport = {
56
51
  ...config,
57
52
  log: ({ level, message, timestamp, splat, ...metadata }) => {
58
- let splatData = splat !== null && splat !== void 0 ? splat : [];
53
+ let splatData = splat ?? [];
59
54
  const stackTrace = getStackTrace(metadata);
60
55
  const strippedInfo = { ...metadata };
61
56
  delete strippedInfo['level'];
@@ -77,5 +72,4 @@ function consoleTransport(config = {}) {
77
72
  };
78
73
  return transport;
79
74
  }
80
- exports.consoleTransport = consoleTransport;
81
75
  //# 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,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,CAAC,EAAE,EAAE,EAAE,CAAC;IACb,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;CACjB,CAAC;AAGF;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,GAAW,EAAE,KAA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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"}
@@ -1,5 +1,5 @@
1
1
  import { ILogTransport, LogTransportConfigBase } from '../types';
2
- export declare type DatadogLogTransportConfig = LogTransportConfigBase;
2
+ export 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,oBAAY,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,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,yBAA8B,iBAStE"}
@@ -1,21 +1,17 @@
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");
1
+ import { getLogMessage } from './utils';
2
+ import { datadogLogs } from '@datadog/browser-logs';
6
3
  /**
7
4
  * A transport that sends logs to Datadog.
8
5
  * Note: This requires the datadog reporter to be initialized for it to work.
9
6
  */
10
- function datadogTransport(config = {}) {
7
+ export function datadogTransport(config = {}) {
11
8
  const transport = {
12
9
  ...config,
13
10
  log: ({ level, message, ...metadata }) => {
14
11
  // Datadog expects a string message.
15
- browser_logs_1.datadogLogs.logger[level]((0, utils_1.getLogMessage)(message), metadata);
12
+ datadogLogs.logger[level](getLogMessage(message), metadata);
16
13
  },
17
14
  };
18
15
  return transport;
19
16
  }
20
- exports.datadogTransport = datadogTransport;
21
17
  //# sourceMappingURL=datadogTransport.js.map
@@ -1 +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"}
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"}