Documentation ¶
Overview ¶
Package v2 implements the lumberjack server supporting protocol version 2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrProtocolError is returned if an protocol error was detected in the // conversation with lumberjack server. ErrProtocolError = errors.New("lumberjack protocol error") )
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. 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 struct {
// contains filtered or unexported fields
}
Server serves multiple lumberjack clients supporting protocol version 2.
func ListenAndServe ¶
ListenAndServe listens on the TCP network address addr and handles batch requests from accepted lumberjack clients.
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.
func NewWithListener ¶
NewWithListener creates a new Server using an existing net.Listener.
func (*Server) Close ¶
Close stops the listener, closes all active connections and closes the receiver channel returned from ReceiveChan().
func (*Server) Receive ¶
Receive returns the next received batch from the receiver channel. Batches returned by Receive must be ACKed.
func (*Server) ReceiveChan ¶
ReceiveChan returns a channel all received batch requests will be made available on. Batches read from channel must be ACKed.