Configuration for extra exceptions information sent with the exception telemetry.

const appInsights = new ApplicationInsights({
config: {
connectionString: 'InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE',
expCfg: {
inclScripts: true,
expLog : () => {
return {logs: ["log info 1", "log info 2"]};
},
maxLogs : 100
}
}
});
appInsights.trackException({error: new Error(), severityLevel: SeverityLevel.Critical});

IExceptionConfig

interface IExceptionConfig {
    expLog?: (() => {
        logs: string[];
    });
    inclScripts?: boolean;
    maxLogs?: number;
}

Properties

expLog?: (() => {
    logs: string[];
})

Callback function for collecting logs to be included in telemetry data.

The length of logs to generate is controlled by the maxLogs parameter.

This callback is called before telemetry data is sent, allowing for dynamic customization of the logs.

Type declaration

    • (): {
          logs: string[];
      }
    • Returns {
          logs: string[];
      }

      An object with the following property:

      • logs: An array of strings, where each string represents a log entry to be included in the telemetry.
      • logs: string[]
inclScripts?: boolean

If set to true, when exception is sent out, the SDK will also send out all scripts basic info that are loaded on the page. Notice: This would increase the size of the exception telemetry.

true

maxLogs?: number

The maximum number of logs to include in the telemetry data. If not explicitly set, it defaults to 50. This is used in conjunction with the expLog callback.