func (client *Client) SetMaxBytes(i int64) {
	client.maxBytes = i
}
SetMaxBytes sets the maximum bytes that will be sent to rsyslog (approximately)
package simplesyslog
import (
	"crypto/tls"
	"errors"
	"fmt"
	"net"
	"os"
	"time"
)
type ConnectionType string
const (
	ConnectionUDP ConnectionType = "udp"
	ConnectionTCP ConnectionType = "tcp"
	ConnectionTLS ConnectionType = "tls"
)
const (
	DefaultHostname string = "unknown"
	DefaultIP string = ""
)
type Client struct {
	Hostname     string    
	IP           string    
	Rfc3164      bool      
	Rfc5424      bool      
	Rfc3339      bool      
	MaxLength    int       
	NoPrio       bool      
	HostnameOnly bool      
	conn         net.Conn  
	bytesSent    int64
	maxBytes     int64
}
func NewClient(connectionType ConnectionType, address string, tlsconfig *tls.Config) (*Client, error) {
	if connectionType != ConnectionUDP && connectionType != ConnectionTCP && connectionType != ConnectionTLS {
		return nil, fmt.Errorf("unknown connection type '%s'", connectionType)
	}
	var (
		conn net.Conn
		err  error
	)
	if connectionType == ConnectionTLS {
		conn, err = tls.Dial(string(ConnectionTCP), address, tlsconfig)
	} else {
		conn, err = net.Dial(string(connectionType), address)
	}
	if err != nil {
		return nil, err
	}
	hostname, err := os.Hostname()
	if err != nil {
		hostname = DefaultHostname
	}
	ip, _, err := net.SplitHostPort(conn.LocalAddr().String())
	if err != nil {
		ip = DefaultIP
	}
	return &Client{
		Hostname: hostname,
		IP:       ip,
		conn:     conn,
	}, nil
}
var TooManyBytesSentErr = errors.New("too many bytes sent")
func (client *Client) Send(message string, priority Priority) error {
	if client.maxBytes != 0 && client.bytesSent > client.maxBytes {
		return TooManyBytesSentErr
	}
	var timestamp string
	if client.Rfc3339 {
		timestamp = time.Now().UTC().Format(time.RFC3339)
	} else {
		timestamp = time.Now().UTC().Format(time.Stamp)
	}
	var hostnameCombi = client.Hostname
	if !client.HostnameOnly {
		hostnameCombi = fmt.Sprintf("%s/%s", client.Hostname, client.IP)
	}
	var header string
	if client.NoPrio {
		header = fmt.Sprintf("%s %s", timestamp, hostnameCombi)
	} else {
		header = fmt.Sprintf("<%d>%s %s", int(priority), timestamp, hostnameCombi)
	}
	length := len(message)
	if client.Rfc3164 && length > 1024 {
		message = fmt.Sprintf("%s...", message[:1021])
	} else if client.Rfc5424 && length > 2048 {
		message = fmt.Sprintf("%s...", message[:2045])
	} else if client.MaxLength > 3 && length > client.MaxLength {
		message = fmt.Sprintf("%s...", message[:client.MaxLength-3])
	}
	n, err := fmt.Fprintf(client.conn, "%s %s", header, message)
	client.bytesSent += int64(n)
	return err
}
func (client *Client) SendRaw(message string) error {
	if client.maxBytes != 0 && client.bytesSent > client.maxBytes {
		return TooManyBytesSentErr
	}
	length := len(message)
	if client.Rfc3164 && length > 1024 {
		message = fmt.Sprintf("%s...", message[:1021])
	} else if client.Rfc5424 && length > 2048 {
		message = fmt.Sprintf("%s...", message[:2045])
	} else if client.MaxLength > 3 && length > client.MaxLength {
		message = fmt.Sprintf("%s...", message[:client.MaxLength-3])
	}
	n, err := fmt.Fprint(client.conn, message)
	client.bytesSent += int64(n)
	return err
}
func (client *Client) Close() error {
	return client.conn.Close()
}