Documentation ¶
Overview ¶
Package papertrailgo is a Go library package which contains code for shipping logs to papertrail
Index ¶
- Constants
- Variables
- type Logger
- type LoggerInterface
- type Payload
- func (*Payload) Descriptor() ([]byte, []int)deprecated
- func (x *Payload) GetHostname() string
- func (x *Payload) GetLog() string
- func (x *Payload) GetLogTime() *timestamp.Timestamp
- func (x *Payload) GetTag() string
- func (*Payload) ProtoMessage()
- func (x *Payload) ProtoReflect() protoreflect.Message
- func (x *Payload) Reset()
- func (x *Payload) String() string
- type SrslogShipper
- type SyslogPacket
Constants ¶
const ( // UDP represents UDP protocol UDP syslogProto = "udp" // TCP represents TCP protocol TCP syslogProto = "tcp" // TLS represents TLS protocol TLS syslogProto = "tcp+tls" )
Variables ¶
var File_payload_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a concrete type of LoggerInterface which collects and ships logs to Papertrail
func NewPapertrailLogger ¶
func NewPapertrailLogger(ctx context.Context, paperTrailProtocol, paperTrailHost string, paperTrailPort int, tag, dbLocation string, retention time.Duration, workerCount int, maxDiskUsage float64) (*Logger, error)
NewPapertrailLogger creates a papertrail log shipper and also returns an instance of Logger
func NewPapertrailLoggerWithShipper ¶
func NewPapertrailLoggerWithShipper(ctx context.Context, dbLocation string, retention time.Duration, workerCount int, maxDiskUsage float64, sLogWriter papertrailShipper) (*Logger, error)
NewPapertrailLoggerWithShipper does some ground work and returns an instance of Logger
type LoggerInterface ¶
LoggerInterface is the interface for all Papertrail logger types
type Payload ¶
type Payload struct { Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` Tag string `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"` LogTime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=log_time,json=logTime,proto3" json:"log_time,omitempty"` Log string `protobuf:"bytes,4,opt,name=log,proto3" json:"log,omitempty"` // contains filtered or unexported fields }
func (*Payload) Descriptor
deprecated
func (*Payload) GetHostname ¶
func (*Payload) GetLogTime ¶
func (*Payload) ProtoMessage ¶
func (*Payload) ProtoMessage()
func (*Payload) ProtoReflect ¶
func (x *Payload) ProtoReflect() protoreflect.Message
type SrslogShipper ¶
type SrslogShipper struct {
// contains filtered or unexported fields
}
SrslogShipper represents srslog shipper
func NewPapertailShipper ¶
func NewPapertailShipper(paperTrailProtocol, paperTrailHost string, paperTrailPort int, tag string) (*SrslogShipper, error)
NewPapertailShipper creates an instance of the papertrail shipper with the given protocol, host, port
func (*SrslogShipper) Close ¶
func (s *SrslogShipper) Close() error
Close will close the syslog writer
func (*SrslogShipper) Dial ¶
func (s *SrslogShipper) Dial() (err error)
Dial attempts to dial a syslog connection
func (*SrslogShipper) Formatter ¶
func (s *SrslogShipper) Formatter(p syslog.Priority, hostname, tag, content string) string
Formatter is actually a dummy placeholder
func (*SrslogShipper) Write ¶
func (s *SrslogShipper) Write(packet *SyslogPacket) (err error)
Write writes packets on the wire