Documentation ¶
Overview ¶
Package server provides lumberjack server implementations. The Server implementation supports multiplexing different protocol versions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrListenerClosed indicates the multiplexing network listener being closed. ErrListenerClosed = errors.New("listener closed") )
var ( // ErrNoVersionEnabled indicates no lumberjack protocol version being enabled // when instantiating a server. ErrNoVersionEnabled = errors.New("No protocol version enabled") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options) error
Option type for configuring server run options.
func Channel ¶
Channel option is used to register custom channel received batches will be forwarded to.
func JSONDecoder ¶
JSONDecoder sets an alternative json decoder for parsing events if protocol version 2 is enabled. The default is json.Unmarshal.
func Keepalive ¶
Keepalive configures the keepalive interval returning an ACK of length 0 to lumberjack client, notifying clients the batch being still active.
type Server ¶
type Server interface { // ReceiveChan returns a channel all received batch requests will be made // available on. Batches read from channel must be ACKed. ReceiveChan() <-chan *lj.Batch // Receive returns the next received batch from the receiver channel. // Batches returned by Receive must be ACKed. Receive() *lj.Batch // Close stops the listener, closes all active connections and closes the // receiver channel returned from ReceiveChan(). Close() error }
Server serves multiple lumberjack clients.
func ListenAndServe ¶
ListenAndServe listens on the TCP network address addr and handles batch requests from accepted lumberjack clients. Use options V1 and V2 to enable wanted protocol versions.
func ListenAndServeWith ¶
func ListenAndServeWith( binder func(network, addr string) (net.Listener, error), addr string, opts ...Option, ) (Server, error)
ListenAndServeWith uses binder to create a listener for establishing a lumberjack endpoint. Use options V1 and V2 to enable wanted protocol versions.
Directories ¶
Path | Synopsis |
---|---|
Package v1 implements the lumberjack server supporting protocol version 1.
|
Package v1 implements the lumberjack server supporting protocol version 1. |
Package v2 implements the lumberjack server supporting protocol version 2.
|
Package v2 implements the lumberjack server supporting protocol version 2. |