log4js-socket.io

Socket.io Appender for log4js-node

Usage no npm install needed!

<script type="module">
  import log4jsSocketIo from 'https://cdn.skypack.dev/log4js-socket.io';
</script>

README

Socket.io Appender for log4js-node

Plugin for log4js > 2.x

npm install log4js-socket.io

Configuration

  • type - log4js-socket.io
  • name - string (optional, defaults to log4js)
  • env - string (optional, defaults to dev)
  • event - string (optional, defaults to log4js)
  • layout - object (optional, defaults to messagePassThroughLayout) - the layout to use for log events (see layouts).

The appender will use the Redis PUBLISH command to send the log event messages to the channel.

Example

log4js.configure({
  appenders: {
    io: { type: 'log4js-socket.io',url:'ws://io.net',name:'crm',env:'dev' }
  },
  categories: { default: { appenders: ['io'], level: 'info' } }
});