zapsyslog

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: MIT Imports: 12 Imported by: 0

README

zap-syslog

GoDoc

Syslog (RFC5424) encoder & syncer for zap.

This repo is forked from (imperfectgo/zap-syslog). Changes are as follows:

  • make BOM optional via configuration
  • put proc-id into square brackets

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSyslogEncoder

func NewSyslogEncoder(cfg SyslogEncoderConfig) zapcore.Encoder

NewSyslogEncoder creates a syslogEncoder.

Types

type ConnSyncer

type ConnSyncer struct {
	// contains filtered or unexported fields
}

ConnSyncer describes connection sink for syslog.

func NewConnSyncer

func NewConnSyncer(network, raddr string) (*ConnSyncer, error)

NewConnSyncer returns a new conn sink for syslog.

func (*ConnSyncer) Sync

func (s *ConnSyncer) Sync() error

Sync implements zapcore.WriteSyncer interface.

func (*ConnSyncer) Write

func (s *ConnSyncer) Write(p []byte) (n int, err error)

Write writes to syslog with retry.

type Framing

type Framing int

Framing configures RFC6587 TCP transport framing.

const (
	NonTransparentFraming Framing = iota
	OctetCountingFraming
	DefaultFraming = NonTransparentFraming
)

Framing.

type SyslogEncoderConfig

type SyslogEncoderConfig struct {
	zapcore.EncoderConfig

	Framing   Framing         `json:"framing" yaml:"framing"`
	Facility  syslog.Priority `json:"facility" yaml:"facility"`
	Hostname  string          `json:"hostname" yaml:"hostname"`
	PID       int             `json:"pid" yaml:"pid"`
	App       string          `json:"app" yaml:"app"`
	WithBOM   bool            `json:"with_bom" yaml:"with_bom"`
	Formatter string          `json:"formatter" yaml:"formatter"`
}

SyslogEncoderConfig allows users to configure the concrete encoders for zap syslog.

Directories

Path Synopsis
encoders
bufferpool
Package bufferpool houses zap's shared internal buffer pool.
Package bufferpool houses zap's shared internal buffer pool.

Jump to

Keyboard shortcuts

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