client-log
v1.0.0
Published
Minimal web client logging to a server
Downloads
2
Readme
Client Log
Installation
None needed. Just clone & reference the main src/index.js file.
Testing
$ npm i
$ npm test
Usage
See example.
<!-- myfile.html -->
<script src="path/to/client-log/index.js"></script>
// myfile.js
if (!window.clientLog)
throw new Error('Failed to init clientLog')
// or if using via Node,
const clientLog = require('client-log')
var log = clientLog({
endpoints: {
logs: 'http://localhost:8080/logs',
errors: 'http://localhost:8080/errors'
}
})
// window.error will now automatically be captured,
// but to trigger an event manually
log.sendLog('message', 'file.html', 1, 2, { foo: 'bar' })