syslog

package
v0.0.0-...-c6b0bb1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 8 Imported by: 1

Documentation

Overview

Package syslog implements a syslog writer over UDP and TCP following RFC5424, RFC5426 and RFC6587. It is designed to serve as an access log writer for gorouter and is therefore not general purpose.

Index

Constants

View Source
const ByteOrderMark = "\ufeff"

ByteOrderMark as required by RFC5424

Variables

View Source
var (
	ErrInvalidNetwork  = fmt.Errorf("syslog: invalid network")
	ErrInvalidPriority = fmt.Errorf("syslog: invalid priority")
)

Functions

This section is empty.

Types

type Priority

type Priority int

The Priority is a combination of the syslog facility and severity. For example, SeverityAlert | FacilityFtp sends an alert severity message from the FTP facility. The default severity is SeverityEmerg; the default facility is FacilityKern.

const (

	// From /usr/include/sys/syslog.h.
	// These are the same on Linux, BSD, and OS X.
	SeverityEmerg Priority = iota
	SeverityAlert
	SeverityCrit
	SeverityErr
	SeverityWarning
	SeverityNotice
	SeverityInfo
	SeverityDebug
)
const (

	// From /usr/include/sys/syslog.h.
	// These are the same up to LOG_FTP on Linux, BSD, and OS X.
	FacilityKern Priority = iota << 3
	FacilityUser
	FacilityMail
	FacilityDaemon
	FacilityAuth
	FacilitySyslog
	FacilityLpr
	FacilityNews
	FacilityUucp
	FacilityCron
	FacilityAuthPriv
	FacilityFtp

	FacilityLocal0
	FacilityLocal1
	FacilityLocal2
	FacilityLocal3
	FacilityLocal4
	FacilityLocal5
	FacilityLocal6
	FacilityLocal7
)

type Writer

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

A Writer is a connection to a syslog server.

func Dial

func Dial(network, address string, severity, facility Priority, appName string) (*Writer, error)

Dial establishes a connection to a log daemon by connecting to address addr on the specified network.

func (*Writer) Close

func (w *Writer) Close() (err error)

Close closes a connection to the syslog daemon.

func (*Writer) Log

func (w *Writer) Log(msg string) error

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Write satisfies io.Writer, however, it is not an io.Writer and lies about the number of bytes written to the syslog server.

Jump to

Keyboard shortcuts

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