func (h *TCPOutlet) Close() {
	close(h.entryChan)
}
FIXME: use this method
package logging
import (
	"bytes"
	"context"
	"crypto/tls"
	"io"
	"log/syslog"
	"net"
	"time"
	"github.com/pkg/errors"
	"github.com/zrepl/zrepl/logger"
)
type EntryFormatter interface {
	SetMetadataFlags(flags MetadataFlags)
	Format(e *logger.Entry) ([]byte, error)
}
type WriterOutlet struct {
	formatter EntryFormatter
	writer    io.Writer
}
func (h WriterOutlet) WriteEntry(entry logger.Entry) error {
	bytes, err := h.formatter.Format(&entry)
	if err != nil {
		return err
	}
	_, err = h.writer.Write(bytes)
	if err != nil {
		return err
	}
	_, err = h.writer.Write([]byte("\n"))
	return err
}
type TCPOutlet struct {
	formatter EntryFormatter
	connect   func(ctx context.Context) (net.Conn, error)
	entryChan chan *bytes.Buffer
}
func NewTCPOutlet(formatter EntryFormatter, network, address string, tlsConfig *tls.Config, retryInterval time.Duration) *TCPOutlet {
	connect := func(ctx context.Context) (conn net.Conn, err error) {
		deadl, ok := ctx.Deadline()
		if !ok {
			deadl = time.Time{}
		}
		dialer := net.Dialer{
			Deadline: deadl,
		}
		if tlsConfig != nil {
			conn, err = tls.DialWithDialer(&dialer, network, address, tlsConfig)
		} else {
			conn, err = dialer.DialContext(ctx, network, address)
		}
		return
	}
	entryChan := make(chan *bytes.Buffer, 1)  
	o := &TCPOutlet{
		formatter: formatter,
		connect:   connect,
		entryChan: entryChan,
	}
	go o.outLoop(retryInterval)
	return o
}