app-logs-collector
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

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

/app-logs-collector/

    Package Sidebar

    Install

    npm i app-logs-collector

    Weekly Downloads

    0

    Version

    1.1.3

    License

    MIT

    Unpacked Size

    78.8 kB

    Total Files

    14

    Last publish

    Collaborators

    • bhagya.pucsd