#
registerLogRocketInstrumentation
Initializes LogRocket instrumentation with Workleap's default settings.
#
Reference
registerLogRocketInstrumentation(appId, options?: { rootHostname, privateFieldNames, privateQueryParameterNames })
#
Parameters
appId
: The LogRocket application id.options
: An optional object literal ofpredefined options .
#
Returns
Nothing
#
Predefined options
The registerLogRocketInstrumentation(appId, options?: {})
function also accepts a few predefined options 👇
#
rootHostname
- Type:
string
- Default:
workleap.com
A root hostname to track sessions across subdomains.
import { registerLogRocketInstrumentation } from "@workleap/logrocket";
registerLogRocketInstrumentation("my-app-id", createTelemetryContext, {
rootHostname: "an-host.com"
});
#
privateFieldNames
- Type:
string[]
- Default:
undefined
Names of additional fields to exclude from session replays. These fields will be removed from network requests, responses using a fuzzy-matching algorithm.
import { registerLogRocketInstrumentation } from "@workleap/logrocket";
registerLogRocketInstrumentation("my-app-id", createTelemetryContext, {
privateFieldNames: ["a-custom-field"]
});
To view the default private fields, have a look at the registerLogRocketInstrumentation.ts file on GitHub.
#
privateQueryParameterNames
- Type:
string[]
- Default:
undefined
Names of additional fields to exclude from session replays. These fields will be removed from query parameters using a fuzzy-matching algorithm.
import { registerLogRocketInstrumentation } from "@workleap/logrocket";
registerLogRocketInstrumentation("my-app-id", createTelemetryContext, {
privateQueryParameterNames: ["a-custom-param"]
});
To view the default private query parameters, have a look at the registerLogRocketInstrumentation.ts file on GitHub.
#
verbose
- Type:
boolean
- Default:
false
Indicates whether or not debug information should be logged to the console.
import { registerLogRocketInstrumentation } from "@workleap/logrocket";
registerLogRocketInstrumentation("my-app-id", createTelemetryContext, {
verbose: true
});
#
Configuration transformers
We do not guarantee that your configuration transformers won't break after an update. It's your responsibility to keep them up to date with new releases.
The transformers
option of the registerLogRocketInstrumentation
function. Remember, no locked in ❤️✌️.
To view the default configuration of registerLogRocketInstrumentation
, have a look at the registerLogRocketInstrumentation.ts file on GitHub.
#
transformers
- Type:
((options: LogRocketSdkOptions, context: LogRocketSdkOptionsTransformer) => LogRocketSdkOptions)[]
- Default:
[]
transformer(options: LogRocketSdkOptions, context: LogRocketSdkOptionsTransformer) => LogRocketSdkOptions;
import { registerLogRocketInstrumentation, type LogRocketSdkOptionsTransformer } from "@workleap/logrocket";
import { createTelemetryContext } from "@workleap/telemetry";
const telemetryContext = createTelemetryContext({ verbose: true });
const disableConsoleLogging: LogRocketSdkOptionsTransformer = config => {
config.console = ...(config.console || {});
config.console.isEnabled = false;
return config;
};
registerLogRocketInstrumentation("my-app-id", createTelemetryContext, {
transformers: [disableConsoleLogging]
});
#
Execution context
Generic transformers can use the context
argument to gather additional information about their execution context, like if they are operating in verbose
mode:
import type { LogRocketSdkOptionsTransformer } from "@workleap/logrocket";
const disableConsoleLogging: LogRocketSdkOptionsTransformer = (config, context) => {
if (!context.verbose) {
config.console = ...(config.console || {});
config.console.isEnabled = false;
}
return config;
}
verbose
:boolean