# socketio-winston-logger

> Socket.io communications logger using a winston logger.

Latest version **1.0.2** (published 2017-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install socketio-winston-logger
pnpm add socketio-winston-logger
yarn add socketio-winston-logger
bun add socketio-winston-logger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-03-06 |
| First published | 2017-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mohamed Baaziz |
| Maintainers | m-baaziz |
| Keywords | socket.io, winston, logger |

## Links

- npm: https://www.npmjs.com/package/socketio-winston-logger
- npm.io page: https://npm.io/package/socketio-winston-logger

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-03-06
- 1.0.1 — 2017-03-06
- 1.0.0 — 2017-03-06

## README

Installation
------------

    npm install --save socketio-winston-logger


Usage
-----

### Server

```js
var io = require('socket.io')();
var path = require('path');
var rfs = require('rotating-file-stream');
var winston = require('winston')
var socketLogger = require('socketio-winston-logger');

var logDirectory = path.join(__dirname, 'log');

io.on('connection', function(socket) {
  socket.on('*', function(){ /* … */ });
});

var socketLogStream = rfs('socket.log', {
  size: '10M',
  compress: 'gzip',
  path: logDirectory
})
var winstonSocketLogger = new (winston.Logger)({
	transports: [
	  new (winston.transports.File)({ 
	  	stream: socketLogStream,
	  	json: false
	  })
	]
});

io.listen(8000);

io.use(socketLogger(winstonSocketLogger));
```

### Client

```js
var io = require('socket.io-client');
var socket = io('http://localhost');
socket.emit('foo', {data: "bar"});
```

---
_Source: https://npm.io/package/socketio-winston-logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
