An http endpoint that provides realtime views.
Copy the following code into your page:
<script>
window.rlog = window.remoteLog = function () {
var text = Array.prototype.slice.call(arguments).map(function (arg) {
return typeof arg === 'object' ? JSON.stringify(arg) : arg;
}).join(' ');
var img = document.createElement('img');
img.src = 'receiver.harttle.com/?text=' + encodeURIComponent(text);
};
rlog('foo', '我爱你**', {foo: 'bar'}); // send anything using rlog
</script>
Checkout http://log.harttle.com for your log.
The receiver is a Node.js-based server and available on npm:
npm i -g http-receiver
PORT=8080 http-receiver
Send log to http://localhost:3000 and checkout http://localhost:8080 for your log.
REC_PORT
: the port to receive data, default 3000WEB_PORT
: the port showing realtime logs, default 8080SIZE
: queue size for the cached requests, default 10