relogger
v1.0.3
Published
Remode logger for systems that have no dev tools
Downloads
8
Readme
relogger
A Remote Login System for devices where local logging is not available or easy (YEP I am talking about windows phone and similars).
Install
$ npm install --save-dev relogger
Usage
Require the 'relogger' and tell him in what port to listen
var relogger = require('relogger');
relogger().listen(1234);
If your page uses https then you need to pass certificate to relogger. If you are running a unix/linux machine you can create the certificate with the following commands:
openssl genrsa -out key.pem
openssl req -new -key key.pem -out csr.pem
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
rm csr.pem
Then, pass the certificates to relogger
var fs = require('fs');
var relogger = require('relogger');
relogger()
.setCredentials(fs.readFileSync('key.pem'), fs.readFileSync('cert.pem'))
.listen(1444);
Once you have the relogger server up and running you will see a message like the one below.
.__
_______ ____ | | ____ ____ ____ ____ _______
\_ __ \_/ __ \ | | / _ \ / ___\ / ___\ _/ __ \ \_ __ \
| | \/\ ___/ | |__( <_> ) / /_/ > / /_/ >\ ___/ | | \/
|__| \___ >|____/ \____/ \___ / \___ / \___ > |__|
\/ /_____/ /_____/ \/
Relogger Server up and running on port: 1444
To enable remote logging please add the following script tag to your page:
<script type="text/javascript" src="https://10.63.85.113:1444/relogger/reloggerclient.js"></script>
Copy the mentioned script tag into you page and you are ready to go. Whenever you want to add a remote log you can do so with:
console.re.log('test log');
console.re.warn('test warn log', {data: 'some data'}, ['MORE DATA']);
console.re.debug('test debug log');
console.re.error('test error log');
The logs are sent through a FIFO queue which ensures that the all the logs happen in order.
Also once you have added relogger to your page, all uncaught errors will automatically be remotely logged.
##relogger-cli We now have a relogger-cli to ease the use of relogger <(^,^)>
If you want to know more please go to https://www.npmjs.com/package/relogger-cli
##Beware relogger has been thought for debugging in development environments. The server sets the header 'Access-Control-Allow-Origin' to '*' which is not very secure.
###Changes from 0.0.x to 1.0.0 I have removed the possibility of adding the relogger to your express app. In order to be able to support remote logs in secure servers (https) and complex logs I had to do more changes on the server configuration.
It is not a good idea to use a remote logging system that changes your server configuration behind the scenes. That is way I have decide to go for a stand alone version only.
I have also changed the syntax to make it more close to node's.