frontend-logging contains a shared interface for logging errors and events to Datadog.
To install frontend-logging into your project::
npm i --save @edx/frontend-logging
In the env.config.js
file, add the following
import { DatadogLoggingService } from '@edx/frontend-logging';
const config = {
loggingService: DatadogLoggingService,
};
export default config;
The DatadogLoggingService is a concrete implementation of the logging service interface that sends messages to Datadog that can be seen in Datadog RUM and Datadog browser logs. When in development mode, all messages will instead be sent to the console.
When you use logError
, your errors will appear under broswer logs for your Browser application.
You can also add your own custom metrics as an additional argument, or see the code to find other standard custom attributes.
General Logging service interface is defined in frontend-platform.