TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Build Status

A transport for winstonjs. Gives you the ability to log directly to a server.

See the examples folder for more usage details.


  • host: The hostname of the server (default: "").
  • port: The port of the server (default: 3000).
  • url: The url you wish to connect to (will override host and port options) (default: "").
  • secure: Use https for the server connection (will be overriden by url option) (default: false).
  • namespace: The namespace to use for the logs (default: "log").
  • log_topic: The topic to send the log messages on (default: "log").
  • log_format: The format in which to log the information.
  • batch: whether or not to batch log messages and send them out in groups instead of immediately when logging (default: false)
  • batch_interval: amount of time in ms to wait after logging to flush log queue and send over the socket (default: 1000)
  • batch_count: maximum number of log messages to queue before sending over the socket (default: 10)
  • max_buffer: The maximum number of messages to queue up for publishing if the client isnt connected to the server or if batching (default: 1000).
  • socket_options: Any options you wish to give to the socket client (default: nothing).

How to use it

  const winston = require('winston');

  let logger = winston.createLogger({
    level: "info",
    transports: [
      new winston.transports.Console(),
      new winston.transports.SocketIO(
          host: "myhost",
          port: 8080
          secure: true,
          namespace: "log",
          log_topic: "log"

  logger.log("info", "I'm logging to the server!!!");
  logger.log("info", "I'm logging something else", {meta: "some additional info"});

Can also be added to Winston as a transport in this method

  const winston = require('winston');

  winston.add(new winston.transports.SocketIO({
    host: "myhost",
    port: 8080
    secure: true,
    namespace: "log",
    log_topic: "log"

Browser Demo

In the example folder is a demo of winston being used on the client side with both the browser console extension and winston logging back to the webserver.

If you want to try it out (Assuming you have nodejs installed):

  git clone https://github/jbass86/
  npm install
  npx gulp build-demo
  node examples/demo/app.js

Then open your browser up and navigate to "localhost:8080"



Package Sidebar


npm i

Weekly Downloads






Unpacked Size

26.4 kB

Total Files


Last publish


  • jbass86