app-logs-collector
v1.1.3
Published
IndexedDB Logger is a package which has capability to collect web application logs and store in Indexed DB of youe browser
Downloads
3
Readme
Logger to catch web application logs in IndexedDB
IndexedDB Logger is a package which has capability to collect web application logs and store in Indexed DB of youe browser
The library app-logs-collector contains many facilities like collecting debug logs, error loga and download those logs in local csv file for reference
Commands
Install the app-logs-collctor library using below command
npm i app-logs-collector
Configuration
To use app-logs-collector in your application use below code
import { IndexedDB } from 'app-logs-collector'
// to add logs in error table
const message = {
location: document.location.href, // location of error filrname/url/component name
error: {
error: error.message, // error message
url: error.url // url
}
};
IndexedDB.getInstance().addToTable('error_logs', message);
// to add logs in debug table
const message = {
url: payload.url, // page url/component name
type: type,
method: payload.method ? payload.method : null, // request method
responsePayload: JSON.stringify(payload.body) // response payload
};
IndexedDB.getInstance().addToTable('debug_logs', message);
// to download reports
IndexedDB.getInstance().getAllData('debug_logs'); // to download debug logs
IndexedDB.getInstance().getAllData('error_logs'); // to doenload error logs
Methods
addToTable(table_name, message) // to add log in table
getAllData(table_name) // to download data in csv