@crimson-education/browser-logger 5.0.3 → 5.0.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.
@@ -10,6 +10,7 @@ import {
10
10
  ReportUser,
11
11
  ServiceInfo,
12
12
  } from '../types';
13
+ import { shouldSuppressAnalyticsEvent } from './analyticsNoise';
13
14
 
14
15
  type PostHogValue = Properties[string];
15
16
 
@@ -283,6 +284,9 @@ export function posthogReporter(info: ServiceInfo, config: PostHogReporterConfig
283
284
  const reporter: IReporter = {
284
285
  ...config,
285
286
  trackEvent: function (event: ReporterEvent): void {
287
+ if (shouldSuppressAnalyticsEvent(event.message, config.ignoreTrackEventPatterns)) {
288
+ return;
289
+ }
286
290
  posthog.capture(event.message, {
287
291
  message: event.message,
288
292
  level: event.level,
@@ -163,6 +163,12 @@ export interface ReporterConfigBase {
163
163
  * This is useful to prevent data of no use for the reporter, or if the data keys are too long.
164
164
  */
165
165
  ignoreMetadataPatterns?: (string | RegExp)[];
166
+
167
+ /**
168
+ * Ignore specific trackEvent messages from analytics-style reporters.
169
+ * This keeps technical log noise out of product analytics/RUM while preserving log reporter output.
170
+ */
171
+ ignoreTrackEventPatterns?: (string | RegExp)[];
166
172
  }
167
173
 
168
174
  /**