1.1.1 • Published 6 years ago

enhanced-diagnostics v1.1.1

Weekly downloads
24
License
MIT
Repository
github
Last release
6 years ago

enhanced-diagnostics

This is a simple tool for transmitting device information and local log to your endpoint.

The idea behind this package is to provide more information to find bugs and help users faster without recording their whole session or destroying their privacy. The user decides if and then he wants to send the data.

Install

npm

npm install enhanced-diagnostics --save

yarn

yarn add enhanced-diagnostics --save

General usage

StepCode
Intercept xhr, fetch and console apiwindow.logger = new DatabaseLogger('my_log_db', 1)
Log all network requests and console stuff to IndexedDBLet diagnostics do the work.
User triggers report of bug/error, collect datalet logReporter = new LogReporter(logger)
Build report, break into chunks, encrypt the chunksThis happens in the sendReport step.
Send report encrypted to serverawait logReporter.sendReport("report.php", publicKey)
Process reportYou must implement this on your server. Sample can be found in /development/report.php

Reporting

| Process |:--:| | Blue parts are handeled using diagnostics, as explained above. The steps in orange you must implement yourself on server side. |

Code Sample

You can find an code sample in /development.

Custom report uploading

If you just need the encrypted plugins but want to specify custom parameters/values or a custom fetch config you can use LogReporter#buildReportChunks`(publicKey : String) : Promise<String>. This gives you the report chunks as json string.

Libraries for your server side