zapGL

package
v0.0.0-...-209974d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GrayConnTCP = "TCP"
	GrayConnUDP = "UDP"
)

Connection types to use

View Source
const MaxPacketSize = 2 * 1024 * 1024

MaxPacketSize max allowed packet size in bytes

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	AppName             string        // app version to encode
	AppVersion          string        // app name to encode
	PanicOnFail         bool          // panic if unable to init the zapcore
	ZapMinLogLevel      zapcore.Level // min log level to send
	GrayLogHostname     string        // host address
	GrayLogConnPort     int           // connection port
	GrayLogConnType     GrayConnType  // udp or tcp
	GrayLogConnPoolInit int           // starting pool size
	GrayLogConnPoolMax  int           // max  Connection pool size
	GrayLogConnTimeOut  time.Duration // timeout in ms, default 2 seconds
	GrayLogBufferCap    int           // capacity of log message buffer
	GrayLogFlushTime    int           // flush timeout for log messages
}

Conf Config to setup the zap Core returned

type Core

type Core struct {
	zapcore.LevelEnabler // filter by severity

	Context []zapcore.Field // zap context fields
	// contains filtered or unexported fields
}

Core returned for use with zap

func New

func New(conf Conf) *Core

New create a from the give conf

func (*Core) Check

func (core *Core) Check(entry zapcore.Entry, checked *zapcore.CheckedEntry) *zapcore.CheckedEntry

Check determines whether the supplied entry should be logged.

func (*Core) Sync

func (core *Core) Sync() error

Sync is a no-op.

func (*Core) With

func (core *Core) With(fields []zapcore.Field) zapcore.Core

With adds structured context to the logger.

func (*Core) Write

func (core *Core) Write(entry zapcore.Entry, fields []zapcore.Field) error

Write writes messages to the configured Graylog endpoint.

type Endpoint

type Endpoint struct {
	Transport Transport
	Address   string
	Port      uint
}

Endpoint represents a graylog endpoint

type GrayConnType

type GrayConnType string

GrayConnType Coonection type to graylog server, UDP or TCP

type Graylog

type Graylog struct {
	Client    *net.Conn
	TLSClient *tls.Conn
}

Graylog represents an established graylog connection

type Message

type Message struct {
	Version      string `json:"version"`
	Host         string `json:"host"`
	ShortMessage string `json:"short_message"`
	FullMessage  string `json:"full_message,omitempty"`
	Timestamp    int64  `json:"timestamp,omitempty"`
	Level        uint   `json:"level,omitempty"`
}

Message represents a GELF formated message

type Transport

type Transport string

Transport represents a transport type enum

const (
	UDP Transport = "udp"
	TCP Transport = "tcp"
)

Transport types

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL