The definition of the word exceptionless is: to be without exception. Exceptionless provides real-time error reporting for your JavaScript applications in the browser or in Node.js. It organizes the gathered information into simple actionable data that will help your app become exceptionless!
You can install the npm package via npm install @exceptionless/browser --save
or via cdn `https://unpkg.com/@exceptionless/browser.Next, you just need to call startup during your apps startup to automaticallycapture unhandled errors.
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);
}
You can install the npm package via npm install @exceptionless/node --save
.Next, you just need to call startup during your apps startup to automaticallycapture unhandled errors.
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);
}
You can install Exceptionless either in your browser application using a script
tag, or you can use the Node Package Manager (npm) to install the package.
Use one of the following methods to install Exceptionless into your browser application:
Add the following script tag at the very beginning of your page:
<script type="module">
import { Exceptionless } from "https://unpkg.com/@exceptionless/browser";
await Exceptionless.startup((c) => {
c.apiKey = "API_KEY_HERE";
});
</script>
npm install @exceptionless/browser --save
.import { Exceptionless } from "@exceptionless/browser";
await Exceptionless.startup((c) => {
c.apiKey = "API_KEY_HERE";
});
Use this method to install Exceptionless into your Node application:
npm install @exceptionless/node --save
.import { Exceptionless } from "@exceptionless/node";
await Exceptionless.startup((c) => {
c.apiKey = "API_KEY_HERE";
});
In order to use Exceptionless, the apiKey
setting has to be configured first.You can configure the ExceptionlessClient
class by callingawait Exceptionless.startup("API_KEY_HERE");
. If you want to configureadditional client settings you'll want to call the startup
overload that takesa callback as shown below:
await Exceptionless.startup((c) => {
c.apiKey = "API_KEY_HERE";
});
Please see the docs formore information on configuring the client.
Once configured, Exceptionless will automatically submit any unhandled exceptionsthat happen in your application to the Exceptionless server. The followingsections will show you how to manually submit different event types as well ascustomize the data that is sent:
You may also want to submit log messages, feature usage data or other kinds of events. You can do this very easily with the fluent API:
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" });
In addition to automatically sending all unhandled exceptions, you may want tomanually send exceptions to the service. You can do so by using code like this:
import { Exceptionless } from "@exceptionless/node";
await Exceptionless.startup("API_KEY_HERE");
try {
throw new Error("test");
} catch (error) {
await Exceptionless.submitException(error);
}
You can easily include additional information in your error reports using the fluent event builder API.
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();
}
The Exceptionless client can also be configured to send data to your self hostedinstance. This is configured by setting the serverUrl
on the defaultExceptionlessClient
when calling startup
:
await Exceptionless.startup((c) => {
c.apiKey = "API_KEY_HERE";
c.serverUrl = "http://localhost:5000";
});
By default the Exceptionless Client will report all available metadata including potential PII data.You can fine tune the collection of information via Data Exclusions or turning off collection completely.
Please visit the docsfor detailed information on how to configure the client to meet your requirements.
If you need help, please contact us via in-app support,open an issueor join our chat on Discord. We’re always here tohelp if you have any questions!
If you find a bug or want to contribute a feature, feel free to create a pull request.
Clone this repository:
git clone https://github.com/exceptionless/Exceptionless.JavaScript.git
Install Node.js. Node is used for building and testing purposes.
Install the development dependencies using npm.
npm install
Build the project by running the following gulp command.
npm run build
Test the project by running the following gulp command.
npm run test
Thanks to all the people who have contributed!
背景 “Exceptionless”一词的定义是:无例外。Exceptionless可为您的JavaScript,Node,.NET Core,ASP.NET,Web API,WebForms,WPF,控制台和MVC应用程序提供实时错误报告。它将收集到的信息组织成简单的可操作数据,这些数据将帮助您的应用程序变得异常异常! Exceptionless专注于实时可配置性,这使其与其他错误监视服务区分开
背景 “Exceptionless”一词的定义是:无例外。Exceptionless可为您的JavaScript,Node,.NET Core,ASP.NET,Web API,WebForms,WPF,控制台和MVC应用程序提供实时错误报告。它将收集到的信息组织成简单的可操作数据,这些数据将帮助您的应用程序变得异常异常! Exceptionless专注于实时可配置性,这使其与其他错误监视服务区分开
Exceptionless 是一个开源的实时的日志收集框架,它可以应用在基于 ASP.NET,ASP.NET Core,Web Api,Web Forms,WPF,Console,MVC 等技术栈的应用程序中,并且提供了Rest接口可以应用在 Javascript,Node.js 中。它将日志收集变得简单易用并且不需要了解太多的相关技术细节及配置。 在以前,我们做日志收集大多使用 Log4net,