### Setup Exceptionless Svelte Kit Example Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/example/svelte-kit/README.md Provides the necessary shell commands to clone the Exceptionless JavaScript repository, install dependencies, navigate to the Svelte Kit example directory, and run the development server. ```shell git clone https://github.com/exceptionless/Exceptionless.JavaScript cd Exceptionless.Javascript npm install cd example/svelte-kit npm run dev -- --open ``` -------------------------------- ### Development Setup and Build Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Instructions for setting up the development environment for the Exceptionless JavaScript project. This includes cloning the repository, installing Node.js, installing dependencies, building the project, and running tests. ```sh git clone https://github.com/exceptionless/Exceptionless.JavaScript.git # Install Node.js (if not already installed) npm install npm run build npm test ``` -------------------------------- ### Configure and Start Exceptionless Client Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/core/README.md Demonstrates how to initialize the Exceptionless client with an API key, set user identity, and configure default data and tags. This setup ensures automatic capturing of unhandled errors. ```javascript import { Exceptionless } from "@exceptionless/core"; await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; c.setUserIdentity("12345678", "Blake"); // set some default data c.defaultData["mydata"] = { myGreeting: "Hello World" }; c.defaultTags.push("Example", "JavaScript"); }); ``` -------------------------------- ### Node.js npm Installation and Startup Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Explains how to install the Exceptionless Node.js package via npm and configure it during application startup. ```JavaScript import { Exceptionless } from "@exceptionless/node"; await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; }); ``` -------------------------------- ### Browser CDN Installation and Startup Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Illustrates installing and configuring Exceptionless in a browser application using a CDN script tag and the startup method. ```HTML ``` -------------------------------- ### Browser npm Installation and Startup Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Details how to install the Exceptionless browser package via npm and configure it during application startup. ```JavaScript import { Exceptionless } from "@exceptionless/browser"; await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; }); ``` -------------------------------- ### Install Exceptionless Client (JavaScript) Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Configuration Instructions for installing the Exceptionless JavaScript client using Bower and including it in an HTML page. ```bash bower install exceptionless ``` ```html ``` -------------------------------- ### Install Exceptionless Client (Node.js) Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Configuration Instructions for installing the Exceptionless Node.js client using npm and requiring it in an application. ```bash npm install exceptionless --save-dev ``` ```javascript var client = require('exceptionless').ExceptionlessClient.default; ``` -------------------------------- ### Configure Self-Hosted Instance Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Provides an example of configuring the Exceptionless client to send data to a self-hosted Exceptionless server. This is done by specifying the `serverUrl` during the `startup` configuration. ```javascript await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; c.serverUrl = "https://localhost:5100"; }); ``` -------------------------------- ### Submit Log Message with Exceptionless in Node.js Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/node/README.md This example shows how to send a simple log message using the Exceptionless client in a Node.js application. It assumes the client has already been configured and started. ```javascript await Exceptionless.submitLog("Hello world!"); ``` -------------------------------- ### Configure and Start Exceptionless Client in Node.js Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/node/README.md This code snippet demonstrates how to initialize and configure the Exceptionless client in a Node.js application. It shows setting the API key and default data/tags, and requires ES6 and Node 18+. ```javascript import { Exceptionless } from "@exceptionless/node"; await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; // set some default data c.defaultData["mydata"] = { myGreeting: "Hello World" }; c.defaultTags.push("Example", "JavaScript", "Node"); }); ``` -------------------------------- ### Log Submission Examples Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/example/browser/index.html Illustrates how to submit various types of log events, including trace, debug, info, warn, and error levels, to the Exceptionless service. This allows for detailed application monitoring and debugging. ```javascript /* * Example: Submit a generic log event */ // Assuming 'exceptionless' is the initialized client instance // exceptionless.submitLog('This is a generic log message', 'Information'); /* * Example: Submit a trace log event */ // exceptionless.submitLog('Trace details here', 'Trace'); /* * Example: Submit a debug log event */ // exceptionless.submitLog('Debug information for analysis', 'Debug'); /* * Example: Submit an info log event */ // exceptionless.submitLog('User logged in successfully', 'Info'); /* * Example: Submit a warn log event */ // exceptionless.submitLog('Low disk space detected', 'Warn'); /* * Example: Submit an error log event */ // exceptionless.submitLog('Failed to process payment', 'Error'); /* * Example: Submit an error log event with a real error object */ try { const data = JSON.parse('{invalid json}'); } catch (e) { // exceptionless.submitLog('Error processing JSON', 'Error', e); } ``` -------------------------------- ### Install Exceptionless Browser via CDN Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/browser/README.md Demonstrates how to install the Exceptionless Browser package using a script tag for direct inclusion in HTML pages. Requires ES6 and ESM module support. ```html ``` -------------------------------- ### Install Exceptionless via npm Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/angularjs/README.md Installs the Exceptionless AngularJS package using npm and includes the bundled JavaScript file in your application. ```html ``` -------------------------------- ### Submit Log Message with Exceptionless Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/core/README.md Shows how to manually submit a log message using the Exceptionless client after it has been configured and started. This is useful for tracking specific events or messages within an application. ```javascript await Exceptionless.submitLog("Hello world!"); ``` -------------------------------- ### Install Exceptionless Browser via npm Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/browser/README.md Provides instructions for installing the Exceptionless Browser package using npm and importing it into your JavaScript application. This method is suitable for projects using module bundlers. ```bash npm install @exceptionless/browser --save ``` ```javascript import { Exceptionless } from "@exceptionless/browser"; await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; }); ``` -------------------------------- ### Error Submission Examples Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/example/browser/index.html Demonstrates various ways to submit custom errors to the Exceptionless service. This includes simple string errors, errors with custom stacking, and handling specific error types like division by zero or index out of range. ```javascript /* * Example: Throwing a custom error */ try { throw new Error('This is a custom error message'); } catch (e) { // Assuming 'exceptionless' is the initialized client instance // exceptionless.submitError(e); } /* * Example: Throwing a division by zero error */ try { const result = 10 / 0; } catch (e) { // exceptionless.submitError(e); } /* * Example: Throwing an index out of range error */ try { const arr = [1, 2, 3]; const value = arr[5]; } catch (e) { // exceptionless.submitError(e); } /* * Example: Throwing an index out of range error with custom stacking */ try { const arr = [1, 2, 3]; const value = arr[5]; } catch (e) { // exceptionless.submitError(e, { stack: 'Custom stack trace here...' }); } /* * Example: Throwing a string error */ try { throw 'This is a string error'; } catch (e) { // exceptionless.submitError(e); } /* * Example: Throwing an ignored error (assuming configuration for ignored errors) */ try { throw new Error('This error should be ignored'); } catch (e) { // If configured, this error might not be submitted. // exceptionless.submitError(e); } /* * Example: Throwing an uncaught reference error */ try { console.log(nonExistentVariable); } catch (e) { // exceptionless.submitError(e); } /* * Example: Throwing a jQuery ajax error */ /* $.ajax({ url: '/nonexistent-api', success: function(data) { console.log(data); }, error: function(jqXHR, textStatus, errorThrown) { // exceptionless.submitError(new Error('AJAX Error: ' + textStatus), { jqXHR: jqXHR }); } }); */ /* * Example: Throwing a promise unhandled rejection */ /* Promise.reject(new Error('Unhandled promise rejection')); */ /* * Example: Throwing a browser extension error */ /* // This would typically involve specific browser extension APIs or contexts // For demonstration, simulating an error object const browserError = new Error('Browser extension specific error'); // exceptionless.submitError(browserError, { context: 'browser-extension' }); */ ``` -------------------------------- ### Submit Various Events (Browser) Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Demonstrates submitting different types of events like logs, feature usages, and not found errors using the fluent API in a browser environment. Includes examples for basic submission and custom event creation with tags. ```javascript import { Exceptionless } from "@exceptionless/browser"; await Exceptionless.submitLog("Logging made easy"); // You can also specify the log source and log level. // We recommend specifying one of the following log levels: Trace, Debug, Info, Warn, Error await Exceptionless.submitLog("app.logger", "This is so easy", "Info"); await Exceptionless.createLog("app.logger", "This is so easy", "Info").addTags("Exceptionless").submit(); // Submit feature usages await Exceptionless.submitFeatureUsage("MyFeature"); await Exceptionless.createFeatureUsage("MyFeature").addTags("Exceptionless").submit(); // Submit a 404 await Exceptionless.submitNotFound("/somepage"); await Exceptionless.createNotFound("/somepage").addTags("Exceptionless").submit(); // Submit a custom event type await Exceptionless.submitEvent({ message: "Low Fuel", type: "racecar", source: "Fuel System" }); ``` -------------------------------- ### Include Exceptionless and Angular Integrations Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Angular-Example This snippet shows how to include the necessary Exceptionless and Angular integration scripts in an HTML page to enable error tracking. Ensure these scripts are loaded before your application's main configuration. ```html ``` -------------------------------- ### Enable Debug Logging Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Angular-Example This method enables debug logging for the Exceptionless client, outputting detailed messages to the console. This is recommended for troubleshooting and understanding the client's behavior. ```javascript $ExceptionlessClient.config.useDebugLogger(); ``` -------------------------------- ### Install Exceptionless via CDN Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/angularjs/README.md Includes the Exceptionless AngularJS package directly in your browser application using a script tag, requiring ES6 and ESM module support. ```html ``` -------------------------------- ### Configure Exceptionless Client in Angular Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Angular-Example This JavaScript code demonstrates how to configure the Exceptionless client within an Angular application. It sets the API key, user identity, enables session tracking, and adds default tags for better error categorization. ```javascript var app = angular.module('myApp', ['exceptionless']); app.config(function($ExceptionlessClient) { $ExceptionlessClient.config.apiKey = 'YOUR_API_KEY'; $ExceptionlessClient.config.setUserIdentity('12345678', 'Blake'); $ExceptionlessClient.config.useSessions(); $ExceptionlessClient.config.defaultTags.push('Example', 'JavaScript', 'Angular'); }); ``` -------------------------------- ### robots.txt Directives Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/example/react/public/robots.txt The robots.txt file uses specific directives to communicate with web crawlers. The User-agent directive specifies the crawler, and Disallow specifies the paths that should not be accessed. This example shows how to disallow all crawlers from accessing any part of the site. ```robots.txt User-agent: * Disallow: ``` -------------------------------- ### Capture 404 Errors in Express.js with Exceptionless Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Express.js-Example This middleware is designed to capture 404 Not Found errors in an Express.js application. It uses the Exceptionless client to create and submit a not found event, enriched with request details. The middleware then responds with a 404 status code. ```javascript app.use(function(req, res, next) { client.createNotFound(req.originalUrl).addRequestInfo(req).submit(); res.status(404).send('Sorry cant find that!'); }); ``` -------------------------------- ### Handle Unhandled Errors in Express.js with Exceptionless Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Express.js-Example This middleware captures unhandled exceptions occurring within an Express.js application. It utilizes the Exceptionless client to create and submit an unhandled exception event, including request information. The middleware then sends a 500 status response to the client. ```javascript app.use(function(err, req, res, next) { client.createUnhandledException(err, 'express').addRequestInfo(req).submit(); res.status(500).send('Something broke!'); }); ``` -------------------------------- ### Node.js Startup and Submit Exception Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Shows how to initialize the Exceptionless client in a Node.js environment using startup and manually submit an exception using submitException. ```JavaScript import { Exceptionless } from "@exceptionless/node"; await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; c.setUserIdentity("12345678", "Blake"); // set some default data c.defaultData["mydata"] = { myGreeting: "Hello World" }; c.defaultTags.push("Example", "JavaScript", "Node"); }); try { throw new Error("test"); } catch (error) { await Exceptionless.submitException(error); } ``` -------------------------------- ### Browser Startup and Submit Exception Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Demonstrates how to initialize the Exceptionless client in a browser environment using startup and manually submit an exception using submitException. ```JavaScript import { Exceptionless } from "https://unpkg.com/@exceptionless/browser"; await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; c.setUserIdentity("12345678", "Blake"); // set some default data c.defaultData["mydata"] = { myGreeting: "Hello World" }; c.defaultTags.push("Example", "JavaScript", "Browser"); }); try { throw new Error("test"); } catch (error) { await Exceptionless.submitException(error); } ``` -------------------------------- ### Configure Client with Callback Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Shows how to configure the Exceptionless client with additional settings, such as API key and user identity, using a callback function during startup. ```JavaScript await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; }); ``` -------------------------------- ### Configure Exceptionless Client Startup Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/browser/README.md Shows how to configure the Exceptionless client during application startup using the `startup` method. This includes setting the API key, user identity, enabling sessions, and adding default data and tags. ```javascript import { Exceptionless } from "@exceptionless/browser"; await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; c.setUserIdentity("12345678", "Blake"); c.useSessions(); // set some default data c.defaultData["mydata"] = { myGreeting: "Hello World" }; c.defaultTags.push("Example", "JavaScript", "Browser"); }); ``` -------------------------------- ### Client Configuration Settings Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/example/browser/index.html Retrieves and logs client configuration settings that have been sent from the server. This is useful for verifying that the client is configured correctly and receiving the latest settings. ```javascript /* * Example: Log client configuration settings received from the server */ // Assuming 'exceptionless' is the initialized client instance // and it has received configuration updates. // The client typically logs these internally or makes them accessible. // To explicitly log them: // const configSettings = exceptionless.config.getSettings(); // Hypothetical method // exceptionless.submitLog('Client Configuration Settings:', 'Information', configSettings); /* * Note: The exact method to access and log settings might vary based on the * specific implementation details of the Exceptionless client library. * Often, configuration is applied automatically upon initialization or update. */ ``` -------------------------------- ### Configure Exceptionless Client (JavaScript) Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Configuration Demonstrates various methods to configure the Exceptionless JavaScript client, including setting the API key via script tag, directly on the default client, or during instance creation with a configuration object. ```html ``` ```javascript exceptionless.ExceptionlessClient.default.config.apiKey = 'API_KEY_HERE'; ``` ```javascript var client = new exceptionless.ExceptionlessClient('API_KEY_HERE'); // or with a api key and server url. var client = new exceptionless.ExceptionlessClient('API_KEY_HERE', 'http://localhost:50000'); // or with a configuration object var client = new exceptionless.ExceptionlessClient({ apiKey: 'API_KEY_HERE', serverUrl: 'http://localhost:50000', submissionBatchSize: 100 }); ``` -------------------------------- ### Configure Exceptionless Startup in Vue.js Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/vue/README.md Configures the Exceptionless client during application startup. This ensures the client is initialized and automatic capturing of unhandled errors is enabled. It requires an API key and can optionally set user identity and default tags. ```javascript import { createApp } from "vue"; import App from "./App.vue"; import { Exceptionless, ExceptionlessErrorHandler } from "@exceptionless/vue"; Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; c.setUserIdentity("12345678", "Blake"); c.defaultTags.push("Example", "Vue"); }); const app = createApp(App); // Set the global vue error handler. app.config.errorHandler = ExceptionlessErrorHandler; app.mount("#app"); ``` -------------------------------- ### Configure Exceptionless Client (Node.js) Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Configuration Shows how to configure the Exceptionless Node.js client by setting the API key on the default instance or creating a new client with specific configuration options like API key, server URL, and batch size. ```javascript var client = require('exceptionless').ExceptionlessClient.default; client.config.apiKey = 'API_KEY_HERE'; ``` ```javascript var exceptionless = require('exceptionless'); var client = new exceptionless.ExceptionlessClient('API_KEY_HERE'); // or with a api key and server url. var client = new exceptionless.ExceptionlessClient('API_KEY_HERE', 'http://localhost:50000'); // or with a configuration object var client = new exceptionless.ExceptionlessClient({ apiKey: 'API_KEY_HERE', serverUrl: 'http://localhost:50000', submissionBatchSize: 100 }); ``` -------------------------------- ### Subscribe to Configuration Changes Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Client-Configuration-Values Demonstrates how to subscribe to events that are triggered whenever client configuration settings are updated. The callback function receives the new configuration object. ```javascript exceptionless.SettingsManager.onChanged(function(configuration) { // configuration.settings contains the new settings }); ``` -------------------------------- ### Configure Exceptionless Client in React App Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/react/README.md Demonstrates how to initialize the Exceptionless client within a React application's lifecycle. It shows setting the API key, user identity, and default tags using the `startup` method, ensuring automatic error capturing. ```jsx import { Exceptionless, ExceptionlessErrorBoundary } from "@exceptionless/react"; class App extends Component { async componentDidMount() { await Exceptionless.startup((c) => { c.apiKey = "API_KEY_HERE"; c.setUserIdentity("12345678", "Blake"); c.defaultTags.push("Example", "React"); }); } render() { return (
// YOUR APP COMPONENTS HERE
); } } export default App; ``` -------------------------------- ### Enable Source Maps for Node.js Debugging Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/node/README.md This command line option is used to launch a Node.js application with source maps enabled. This improves the accuracy of stack traces when debugging, especially when using transpiled code. ```bash node app.js --enable-source-maps ``` -------------------------------- ### Configure AngularJS with Exceptionless Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/angularjs/README.md Configures the Exceptionless client within an AngularJS application by injecting the $ExceptionlessClient service and calling its startup method with API key and default tags. ```js angular .module("app", ["exceptionless"]) .config(function ($ExceptionlessClient) { await $ExceptionlessClient.startup((c) => { c.apiKey = "API_KEY_HERE"; c.defaultTags.push("Example", "JavaScript", "angularjs"); }); }); ``` -------------------------------- ### Client Logs Management Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/example/browser/index.html This section refers to the management of logs generated by the client itself. It implies that the Exceptionless client can generate and potentially submit its own internal logs for debugging purposes. ```javascript /* * Client Logs Management * This refers to the internal logging capabilities of the Exceptionless client. * The client might log its own operational events, errors, or status updates. * These logs can be useful for diagnosing issues with the client integration itself. * * Example: Accessing or enabling client-side logging (hypothetical) */ // Assuming 'exceptionless' is the initialized client instance // The client might have a configuration option to enable verbose logging: // exceptionless.config.setOption('logLevel', 'Debug'); // Hypothetical setting // Or a method to retrieve internal logs: // const internalLogs = exceptionless.getInternalLogs(); // console.log('Exceptionless Client Internal Logs:', internalLogs); /* * Note: The specific mechanisms for managing client logs depend on the * library's design. Often, these logs are directed to the browser's * console or can be configured to be submitted as events. */ ``` -------------------------------- ### Enable Client Debug Logging Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Troubleshooting Configures the Exceptionless client to output diagnostic messages to the console, which is crucial for diagnosing any issues with the client's operation. Dependencies: Exceptionless client library. ```javascript exceptionless.ExceptionlessClient.default.config.useDebugLogger(); ``` ```nodejs var client = require('exceptionless').ExceptionlessClient.default; client.config.useDebugLogger(); ``` -------------------------------- ### Configure Server URL for Self-Hosted Instances Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Self-Hosted-Options Sets the serverUrl to point to a self-hosted Exceptionless instance. This is essential for clients to communicate with your private Exceptionless deployment. ```javascript exceptionless.ExceptionlessClient.default.config.serverUrl = 'http://localhost:50000'; ``` ```nodejs var client = require('exceptionless.node').ExceptionlessClient.default; client.config.serverUrl = 'http://localhost:50000'; ``` -------------------------------- ### Manually Submit Errors (Node.js) Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Shows how to manually capture and submit exceptions to Exceptionless in a Node.js environment. It includes setting up the client with an API key and using a try-catch block to submit caught errors. ```javascript import { Exceptionless } from "@exceptionless/node"; await Exceptionless.startup("API_KEY_HERE"); try { throw new Error("test"); } catch (error) { await Exceptionless.submitException(error); } ``` -------------------------------- ### Manually Update Configuration Settings Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Client-Configuration-Values Provides the method to manually trigger an update of the client's configuration settings. This is useful for refreshing settings on demand. ```javascript exceptionless.SettingsManager.updateSettings(client.config); ``` -------------------------------- ### Set Application Version Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Configuration Specifies the application version for the Exceptionless client. Setting an application version can enable additional functionality and is a good practice for tracking and managing exceptions across different releases. ```javascript exceptionless.ExceptionlessClient.default.config.setVersion("1.2.3"); ``` ```nodejs var exceptionless = require('exceptionless'); exceptionless.ExceptionlessClient.default.config.setVersion("1.2.3"); ``` -------------------------------- ### Configure Exceptionless Client Settings Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Configuration Sets various configuration options for the Exceptionless client, such as including user name, machine name, IP addresses, cookies, POST data, and query string information. These settings control the data collected with each exception report. ```javascript // Include the username if available. exceptionless.ExceptionlessClient.default.config.includeUserName = false; // Include the MachineName in MachineInfo. exceptionless.ExceptionlessClient.default.config.includeMachineName = false; // Include Ip Addresses in MachineInfo and RequestInfo. exceptionless.ExceptionlessClient.default.config.includeIpAddress = false; // Include Cookies, please note that DataExclusions are applied to all Cookie keys when enabled. exceptionless.ExceptionlessClient.default.config.includeCookies = false; // Include Form/POST Data, please note that DataExclusions are only applied to Form data keys when enabled. exceptionless.ExceptionlessClient.default.config.includePostData = false; // Include Query String information, please note that DataExclusions are applied to all Query String keys when enabled. exceptionless.ExceptionlessClient.default.config.includeQueryString = false; ``` ```nodejs var exceptionless = require('exceptionless'); // Include the username if available. exceptionless.ExceptionlessClient.default.config.includeUserName = false; // Include the MachineName in MachineInfo. exceptionless.ExceptionlessClient.default.config.includeMachineName = false; // Include Ip Addresses in MachineInfo and RequestInfo. exceptionless.ExceptionlessClient.default.config.includeIpAddress = false; // Include Cookies, please note that DataExclusions are applied to all Cookie keys when enabled. exceptionless.ExceptionlessClient.default.config.includeCookies = false; // Include Form/POST Data, please note that DataExclusions are only applied to Form data keys when enabled. exceptionless.ExceptionlessClient.default.config.includePostData = false; // Include Query String information, please note that DataExclusions are applied to all Query String keys when enabled. exceptionless.ExceptionlessClient.default.config.includeQueryString = false; ``` -------------------------------- ### Submit Logs and Feature Usage Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/react/README.md Illustrates how to send custom logs and track feature usage events using the Exceptionless client. These methods allow for detailed application monitoring beyond just errors. ```js await Exceptionless.submitLog("Hello, world!"); await Exceptionless.submitFeatureUsage("New Shopping Cart Feature"); ``` -------------------------------- ### Send Logs, Feature Usages, and Not Found Events with Exceptionless Client Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Sending-Events Demonstrates how to send various event types like logs, feature usages, and 404 errors using the Exceptionless client's fluent API. It covers specifying log levels, sources, and adding tags. ```javascript var client = exceptionless.ExceptionlessClient.default; // Node.Js // var client = require('exceptionless').ExceptionlessClient.default; client.submitLog('Logging made easy'); // You can also specify the log source and log level. // We recommend specifying one of the following log levels: Trace, Debug, Info, Warn, Error client.submitLog('app.logger', 'This is so easy', 'Info'); client.createLog('app.logger', 'This is so easy', 'Info').addTags('Exceptionless').submit(); // Submit feature usages client.submitFeatureUsage('MyFeature'); client.createFeatureUsage('MyFeature').addTags('Exceptionless').submit(); // Submit a 404 client.submitNotFound('/somepage'); client.createNotFound('/somepage').addTags('Exceptionless').submit(); // Submit a custom event type client.submitEvent({ message = 'Low Fuel', type = 'racecar', source = 'Fuel System' }); ``` -------------------------------- ### Submit Logs and Feature Usage Events Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/vue/README.md Shows how to send custom log messages and track feature usage events to Exceptionless. These methods allow for detailed monitoring of application behavior beyond just errors. The Exceptionless client is accessible globally after startup. ```javascript import { Exceptionless } from "@exceptionless/vue"; // Submit a log message await Exceptionless.submitLog("Hello, world!"); // Submit a feature usage event await Exceptionless.submitFeatureUsage("New Shopping Cart Feature"); ``` -------------------------------- ### Submit a Log Message Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/browser/README.md Illustrates how to manually submit a log message using the Exceptionless client after it has been configured. This is useful for tracking specific events or messages within your application. ```javascript await Exceptionless.submitLog("Hello world!"); ``` -------------------------------- ### Benchmark: Prune Large Object Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/example/browser/index.html This section describes a benchmark test designed to measure the performance of pruning large objects, executed 1000 times. It's intended to stress-test object manipulation capabilities. ```javascript /* * Benchmark: Prune Large Object (1000 times) * This is a conceptual description of a benchmark test. * Actual implementation would involve creating a large object, * defining a pruning function, and timing its execution over 1000 iterations. */ /* function createLargeObject() { const obj = {}; for (let i = 0; i < 1000; i++) { obj[`key_${i}`] = { nested: i, data: Math.random() }; } return obj; } function pruneObject(obj) { // Logic to prune the object, e.g., remove specific keys or deep clean // For example, removing keys with null values or limiting nesting depth return obj; } const largeObject = createLargeObject(); const startTime = performance.now(); for (let i = 0; i < 1000; i++) { pruneObject(JSON.parse(JSON.stringify(largeObject))); // Operate on a copy } const endTime = performance.now(); const duration = endTime - startTime; // Log the benchmark result // exceptionless.submitLog(`Prune Large Object benchmark took ${duration}ms`, 'Information'); */ ``` -------------------------------- ### Send Additional Information with Events (Node.js) Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/README.md Illustrates how to enrich error reports with custom data using the event builder API in Node.js. This includes setting reference IDs, properties, tags, user identity, and geographical coordinates before submitting the event. ```javascript import { Exceptionless } from "@exceptionless/node"; await Exceptionless.startup("API_KEY_HERE"); try { throw new Error("Unable to create order from quote."); } catch (error) { await Exceptionless.createException(error) // Set the reference id of the event so we can search for it later (reference:id). .setReferenceId("random guid") // Add the order object (the ability to exclude specific fields will be coming in a future version). .setProperty("Order", order) // Set the quote number. .setProperty("Quote", 123) // Add an order tag. .addTags("Order") // Mark critical. .markAsCritical() // Set the coordinates of the end user. .setGeo(43.595089, -88.444602) // Set the user id that is in our system and provide a friendly name. .setUserIdentity(user.Id, user.FullName) // Submit the event. .submit(); } ``` -------------------------------- ### Disable Automatic Configuration Updates Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Client-Configuration-Values Shows how to disable the automatic checking and updating of client configuration settings when the client is idle. Setting the interval to -1 prevents background updates. ```javascript client.config.updateSettingsWhenIdleInterval = -1; ``` -------------------------------- ### Process Event Queue Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Troubleshooting Manually triggers the processing of the event queue to ensure events are sent before an application terminates. This can help when the application process ends abruptly. Dependencies: Exceptionless client library. ```javascript exceptionless.ExceptionlessClient.default.config.queue.process(); ``` ```nodejs var client = require('exceptionless').ExceptionlessClient.default; client.config.queue.process(); ``` -------------------------------- ### Conditionally Cancel Log Submission Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Client-Configuration-Values Demonstrates how to conditionally cancel log event submission at runtime using a client-side plugin. This allows disabling log submissions based on a configuration setting without redeploying the application. ```javascript exceptionless.ExceptionlessClient.default.config.addPlugin('Conditionally cancel log submission', 100, function (context, next) { var enableLogSubmission = context.client.config.settings['enableLogSubmission']; // only cancel event submission if it’s a log event and // enableLogSubmission is set to a value and the value is not true. if (context.event.type === 'log' && (!!enableLogSubmission && enableLogSubmission !== 'true')) { context.cancelled = true; } next(); }); ``` -------------------------------- ### Submit Log Message with Exceptionless Client Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/angularjs/README.md Demonstrates how to use the injected $ExceptionlessClient to submit a log message from anywhere within your AngularJS application. ```js await $ExceptionlessClient.submitLog("Hello world!"); ``` -------------------------------- ### Add Custom Properties and Metadata to Exceptionless Events Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Sending-Events Illustrates how to enrich exception reports with custom data using the event builder API. This includes setting reference IDs, properties, tags, geo-location, and user identity before submitting. ```javascript var client = exceptionless.ExceptionlessClient.default; // Node.Js // var client = require('exceptionless').ExceptionlessClient.default; try { throw new Error('Unable to create order from quote.'); } catch (error) { client.createException(error) // Set the reference id of the event so we can search for it later (reference:id). // This will automatically be populated if you call client.config.useReferenceIds(); .setReferenceId('random guid') // Add the order object (the ability to exclude specific fields will be coming in a future version). .setProperty("Order", order) // Set the quote number. .setProperty("Quote", 123) // Add an order tag. .addTags("Order") // Mark critical. .markAsCritical() // Set the coordinates of the end user. .setGeo(43.595089, -88.444602) // Set the user id that is in our system and provide a friendly name. .setUserIdentity(user.Id, user.FullName) // Submit the event. .submit(); } ``` -------------------------------- ### Manually Submit Exceptions with Exceptionless Client Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Sending-Events Shows how to manually capture and send exceptions to the Exceptionless service using a try-catch block. This is useful for reporting errors that are caught but still need to be logged. ```javascript var client = exceptionless.ExceptionlessClient.default; // Node.Js // var client = require('exceptionless').ExceptionlessClient.default; try { throw new Error('test'); } catch (error) { client.submitException(error); } ``` -------------------------------- ### Submit Exception from Utility Function Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/vue/README.md Demonstrates how to manually submit a caught exception to Exceptionless from a non-component function. This is useful for error handling in utility modules or background tasks. The Exceptionless client is a singleton and can be imported directly. ```javascript import { Exceptionless } from "@exceptionless/vue"; export const myUtilityFunction = async () => { try { // Handle successful run of code } catch (e) { // If there's an error, send it to Exceptionless await Exceptionless.submitException(e); } }; ``` -------------------------------- ### Submit Exception from Utility Function Source: https://github.com/exceptionless/exceptionless.javascript/blob/main/packages/react/README.md Shows how to catch an error in a JavaScript utility function and submit it to Exceptionless using `submitException`. This ensures errors occurring outside React components are captured and reported. ```js export const myUtilityFunction = async () => { try { // Handle successful run of code } catch (e) { // If there's an error, send it to Exceptionless await Exceptionless.submitException(e); } }; ``` -------------------------------- ### GDPR Compliance: Disable PII Collection (JavaScript/Node.js) Source: https://github.com/exceptionless/exceptionless.javascript/wiki/Configuration Configures the Exceptionless client to disable the collection of Personally Identifiable Information (PII) for GDPR compliance. This can be done via a query parameter in the script tag or by setting a configuration property on the client instance. ```html ``` ```javascript exceptionless.ExceptionlessClient.default.config.includePrivateInformation = false; ``` ```javascript var exceptionless = require('exceptionless'); exceptionless.ExceptionlessClient.default.config.includePrivateInformation = false; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.