Log.js v1.0 has been released. Thanks to your help, the first version is finally available. Welcome your suggestions or comments. Of course, we can star that is better haha

Welcome to submit issues, I will reply as soon as possible.

What is thelog.js

Log.js is a front-end monitoring plug-in that allows you to monitor performance errors and terminal information for your Web applications with just one line of code

A simple use of chestnuts

The < head > < meta charset = "utf-8" > < title > example < / title > < script SRC = ". / log. Min. Js "> < / script > < / head > < body > < script > the init ();  </script> </body>Copy the code
//React/Vue project NPM I logjs. NPM import log from 'logjs. NPM '; log.init();Copy the code

As a Web developer, I know the pain of reading API documentation, so I chose to design log.js in out-of-the-box mode, with just a call to log.init to launch it

Where does the log information go

Log. js does not report logs privately. After you configure the report configuration, it reports logs in a way that web applications are unaware of. In addition, it provides the log storage capability.

How will logs be stored

By default, logs are stored and reported every five seconds. Logs generated within five seconds are captured at a frequency.



log.init(); Init ({id: 'log-id',// Carries a special identifier for the terminal, which will be carried in the report packet path: '<https://test.do>',// Report address, default POST JSON format for reporting logType: ['click', 'error', 'request'],// Request before: (params, terminalInfo) => do something; (params) => do something; (params) => do something; // Adjust the data structure of the packet before the packet is reported. The default value is params}.Copy the code


log.durationLog((terminalInfo)=>{ do something; }, 5000) // Create a time listener for a certain moment, calling the first parameter every second parameter in millisecondsCopy the code

Update log

V1.1.0 – Functional planning

  • Storage Mode SupportindexDB
  • The reporting time is adjusted toIdle Mode reportingTo reduce the impact on service system performance

V1.0.0 – Features (implemented)

  • Capture ability: JS execution error Fetch/XHR interface call Click on the page The FETCH/XHR interface is abnormal Terminal information
  • Log storage mode: localStroage sessionStorage The interface reporting