Skip to content

Commit 92a14a1

Browse files
committed
add signal debug bool
1 parent 3d29c67 commit 92a14a1

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

packages/signals/signals/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
],
2626
"scripts": {
2727
".": "yarn run -T turbo run --filter=@segment/analytics-signals...",
28+
"..": "yarn run -T turbo run --filter=...@segment/analytics-signals...",
2829
"test": "yarn jest",
2930
"lint": "yarn concurrently 'yarn:eslint .' 'yarn:tsc --noEmit'",
3031
"build": "rm -rf dist && yarn concurrently 'yarn:build:*'",

packages/signals/signals/src/core/signals/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type SignalsSettingsConfig = Pick<
2727
| 'mutationGenObservedTags'
2828
| 'mutationGenPollInterval'
2929
| 'mutationGenObservedAttributes'
30+
| 'debug'
3031
> & {
3132
signalStorage?: SignalPersistentStorage
3233
processSignal?: string

packages/signals/signals/src/core/signals/signals.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ export class Signals implements ISignals {
3939
this.globalSettings = new SignalGlobalSettings(settingsConfig)
4040
this.buffer = getSignalBuffer(this.globalSettings.signalBuffer)
4141
this.signalEmitter = this.getSignalEmitter(settingsConfig.middleware)
42+
if (settingsConfig.debug) {
43+
this.debug()
44+
}
4245

4346
// We register the generators (along with the signal emitter) so they start collecting signals before the plugin is started.
4447
// Otherwise, we would wait until analytics is loaded, which would skip things like page network URL changes.

packages/signals/signals/src/plugin/signals-plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class SignalsPlugin implements Plugin, SignalsAugmentedFunctionality {
4141
})
4242

4343
this.signals = new Signals({
44+
debug: settings.debug,
4445
disableSignalsRedaction: settings.disableSignalsRedaction,
4546
enableSignalsIngestion: settings.enableSignalsIngestion,
4647
flushAt: settings.flushAt,

packages/signals/signals/src/types/settings.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ export interface SignalsPluginSettingsConfig {
1212
*/
1313
processSignal?: string | ProcessSignal
1414

15+
/**
16+
* Enable debug mode. Same as ?debug=true in the URL or SignalsPlugin.debug(true)
17+
* This sets the log level to 'info', disables redaction, and enables signals ingestion
18+
* @default false
19+
*/
20+
debug?: boolean
21+
1522
/**
1623
* Add console debug logging
1724
* @default false

0 commit comments

Comments
 (0)