0.9.5 • Published 6 years ago

bunyan-tcp v0.9.5

Weekly downloads
345
License
ISC
Repository
github
Last release
6 years ago

bunyan-tcp

TCP transport for Bunyan with reconnection.

Quick start:

var tcpStream = bunyanTcp.createBunyanStream({
  server: 'my.logging.server',
  port: 1234,
});

var log = bunyan.createLogger({
    name: 'log',
    streams: [
        {
          level: 'info',
          stream: tcpStream,
          type: 'raw',
          closeOnExit: true
        }
    ]
});

Options

NameDescriptionDefault
server (required)The host to connect tonone
port (required)The server port to connect tonone
reconnectDelayTime to pause between disconnect and reconnect (in ms)5000ms
offlineBufferNumber of messages to buffer while disconnected100 messages
transformA function that takes a bunyan event and returns a JSON object that will be serialized to the remote serveridentity

Events

NameDescriptionArguments
connectingEmitted when the stream attempts a connectionNumber of unsuccessful connection attempts
connectEmitted on successful connectionNumber of successful connections during the life of this process.
disconnectGot disconnected from the remote servernone
dropped_messagesEmitted when the stream reconnects if some events have been discarded to stay in buffer limitsNumber of dropped messages.

Methods

NameDescription
connectIf previously closed, attempts to reconnect. This is called on instantiation.
closeDisconnect from the remote server
bufferedMessageCountIf currently disconnected, the number of messages in offline buffer
droppedMessageCountIf currently disconnected, number of messages that have been discarded
0.9.5

6 years ago

0.9.3

9 years ago

0.9.2

9 years ago

0.9.1

9 years ago

0.9.0

9 years ago