1.2.3 • Published 4 years ago

bitnacle-io v1.2.3

Weekly downloads
26
License
MIT
Repository
github
Last release
4 years ago

bitnacle-io

Build Status David David npm

bitnacle-io is a dead simple middleware logger to use with socket.io.

Installation

npm i bitnacle-io

Quick start

const io = require('socket.io')();
const bitnacleIo = require('bitnacle-io');

io.on('connection', socket => { 
    
    socket.use(bitnacleIo()); // use default "simple" format

    ...

});

io.listen(3000);

If you want to skip some events, you can do it by passing an array of event names to bitnacle-io and they won't be logged:

socket.use(bitnacleIo({
    exclude: [
        'event_name',
        'another_event_name',
        'yet_another_event_name'
    ]
}));

Formats

bitnacle-io uses 2 formats, simple (default) and json.

socket.use(bitnacleIo({
    format: 'json' // optional: default is "simple"
}));

simple format output:

[2019-08-25T20:01:11:130+0200] ["some_event",{"someKey":"someValue"}]

json format output:

{"time":"2019-08-25T20:02:43:125+0200","eventData":["some_event",{"someKey":"someValue"}]}
1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.1-alpha

5 years ago

1.0.0-alpha

5 years ago