Simple logger middleware for socket.io.
$ npm install socket.io-logger
var fs = ;var io = 3000;var options = stream: fs ;var logger = options;io;
Features
- Data is flattened with flat.
- Customized formatting support.
- Plugable interface to use with your favorite logger packages.
API
Logger
var Logger = ;
Logger#
io;
By default the logger middleware will write to stdout
.
Logger#(options:Object)
var options = stream: fs { return sock:sockid args: args; };io;
You can use anything as long as the stream
has a write
method.
var options = stream: { console; } ;io;
Logger#stream (stream:Object)
The stream
must have a write
method.
var stream = fs;var logger = ;logger;io;
Logger#format (format:Function)
Set a customized function to manipulate the data that will be serialized.
var { return sock: sockid name: args data: args ;}; var logger = ;logger;io;
Installation and Environment Setup
Install node.js (See download and install instructions here: http://nodejs.org/).
Clone this repository
> git clone git@github.com:turbonetix/socket.io-logger.git
cd into the directory and install the dependencies
> cd socket.io-logger
> npm install && npm shrinkwrap --dev
Running Tests
Install coffee-script
> npm install coffee-script -g
Tests are run using grunt. You must first globally install the grunt-cli with npm.
> sudo npm install -g grunt-cli
Unit Tests
To run the tests, just run grunt
> grunt spec