syslog

package module
v0.0.0-...-6ae7469 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

syslog-go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder interface {
	SetPriority(facility int, severity int) error
	SetTimestamp(stamp time.Time) error
	SetHostname(hostname string) error
	// tag is only implemented in rfc3164. It should have
	// process or application that generated the message.
	SetMsg(tag string, content string) error
	// Unimplemented in rfc3164, instead one can add the app
	// name in the tag section of the msg.
	SetAppName(appName string) error
	String() string
}

Builder interface contains the methods required to build a valid syslog message. Note that the interface might have methods specific to certain syslog RFC's.

type Client

type Client interface {
	Send(data string) error
	Protocol() client.Protocol
	SetTimeout(dur time.Duration) error
	Close() error
}

Client interface contains methods to send a syslog messages. It can be a file writer or socket writer as long as a single write is performed.

type Format

type Format int

Format represents the different syslog formats to choose from.

const (
	Auto Format = iota
	RFC3164
	RFC5424
	RFC5425
)

Different formats.

func (Format) String

func (f Format) String() string

String returns string representation of format.

type Syslog

type Syslog interface {
	Send(format Format, facility int, severity int, obj interface{}) error
}

Syslog is the main interface which is used to send the syslog message in the given format. The obj can be of any arbitrary type. Encoding the obj totally depends on the implementation and the use case. Complete RFC compliant.

func New

func New(client Client) (Syslog, error)

New returns a snew Syslog handle to dispatch syslog messages.

Directories

Path Synopsis
builders
mockclient
Package mockclient is a generated GoMock package.
Package mockclient is a generated GoMock package.

Jump to

Keyboard shortcuts

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