Documentation
If you have any questions that are beyond the scope of this documentation, Please feel free to create a Support Ticket.
Install
At present, we have released a module exclusively for Node.js
. Soon, we'll begin to support Go, Python, Ruby, and other programming languages.
You can install the Errsole module in your Node.js app using the npm install command:
npm install @errsole/node
Configure
You must obtain a unique token to configure the Errsole module in your app.
Follow these steps to generate a token:
- Create an Errsole account or sign in with an existing one.
- Create an entry for your app.
- Copy the code snippet generated for your app, which includes a unique token.
- Insert the code snippet as the first line of your app's main file.
- Deploy your app as usual. Once deployed, Errsole will start capturing errors and associating them with your app's entry in the Errsole platform.
Example
/**
* Insert this Errsole code snippet as the first line of your app's main file
*/
const errsole = require('@errsole/node');
errsole.initialize({
framework: 'express',
token: '[Your Errsole Token]'
});
// End of Errsole code snippet
/**
* Your app code starts here
*/
const express = require('express');
const app = express();
app.get('/', function (req, res) {
res.send('Hello World');
});
app.listen(3000);
Advanced Configuration
Name | Type | Description |
---|---|---|
framework | string | Required. Your Node.js framework name. |
token | string | Required. Create a unique token for your app on the Errsole website. |
exitOnException | boolean | Optional. The default value is true. By default, Errsole will exit the process after capturing an uncaught exception. If this is not the behavior you want, you can disable it by setting exitOnException to false. |
skipRoutes | Array | Optional. The default value is []. Errsole does not save any HTTP requests that match the routes specified in this list. |
filterRoutes | Array | Optional. The default value is []. Errsole only captures the Method, URL, and Status Code of HTTP requests that match the routes specified in this list. |
collectLogs | Array | Optional. The default value is ['info', 'error']. By default, Errsole collects both info and error logs. If you wish to limit Errsole to collecting only error logs, you can set this option to ['error']. If you prefer Errsole not to collect any logs, simply set this option to an empty array, []. Added in: v1.7.0 |
enableSessionLogs | boolean | Optional. The default value is true. This parameter controls whether to save session logs in addition to error details. |
responseTimeThreshold | number | Optional. The default value is 1000. This parameter specifies a benchmark duration in milliseconds that Errsole uses to recognize slow HTTP requests. By default, this threshold is set to 1000 milliseconds (1 second), meaning that any HTTP request that takes longer than one second to complete is categorized as slow. |
slowRequestsTimeInterval | number | Optional. The default value is 24. This parameter defines a designated time interval for gathering data on slow requests. You can select from four valid options: 1, 6, 12, and 24, corresponding to 1-hour, 6-hour, 12-hour, and 24-hour time intervals. |
enableDebugger | boolean | Optional. The default value is true. If false, the Errsole Debugger is disabled. |
evalExpression | boolean | Optional If true, your developers have the ability to evaluate JavaScript expressions while debugging an error. This feature allows your developers to debug your app's code more effectively, but it also grants them the ability to run arbitrary code on your server. You have two options: You can set it to false here to disable the eval expression option for all developers, or you can set it to true here and manage the permissions of each developer on the errsole website. |
Advanced Configuration Example
/**
* Insert this Errsole code snippet as the first line of your app's main file
*/
const errsole = require('@errsole/node');
errsole.initialize({
framework: 'express',
token: '[Your Errsole Token]',
exitOnException: true,
skipRoutes: [{
method: 'POST',
path: '/users/login'
}],
filterRoutes: [{
method: 'PUT',
path: '/users/:userId/profile'
}],
enableSessionLogs: true,
responseTimeThreshold: 1000,
slowRequestsTimeInterval: 24,
enableDebugger: true,
evalExpression: true
});
// End of Errsole code snippet
/**
* Your app code starts here
*/
const express = require('express');
const app = express();
app.get('/', function (req, res) {
res.send('Hello World');
});
app.listen(3000);
Verify Setup
Follow these steps to verify your Errsole setup:
- Start by signing into Errsole and navigating to the Apps page.
- Once on the Apps page, click the Processes option from your app's right menu.
- On the Processes page, you will find information about your app processes listed under their respective environments.
- If you do not see any app process listed, there might be a problem with your Errsole configuration. Ensure the Errsole code snippet is at the beginning of your app's main file. Examine your app logs to learn more about the error.
- We advise creating a support ticket if you still face problems or have more questions.
Please create a support ticket. Our team will swiftly assist you in resolving any concerns.