syslog

package
v0.0.0-...-ec220af Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// From /usr/include/sys/syslog.h.
	// These are the same on Linux, BSD, and OS X.
	LOG_EMERG sg.Priority = iota
	LOG_ALERT
	LOG_CRIT
	LOG_ERR
	LOG_WARNING
	LOG_NOTICE
	LOG_INFO
	LOG_DEBUG
)
View Source
const (

	// From /usr/include/sys/syslog.h.
	// These are the same up to LOG_FTP on Linux, BSD, and OS X.
	LOG_KERN sg.Priority = iota << 3
	LOG_USER
	LOG_MAIL
	LOG_DAEMON
	LOG_AUTH
	LOG_SYSLOG
	LOG_LPR
	LOG_NEWS
	LOG_UUCP
	LOG_CRON
	LOG_AUTHPRIV
	LOG_FTP

	LOG_LOCAL0
	LOG_LOCAL1
	LOG_LOCAL2
	LOG_LOCAL3
	LOG_LOCAL4
	LOG_LOCAL5
	LOG_LOCAL6
	LOG_LOCAL7
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	SyslogVersion  string
	PING_PREFIX    string
	SOCKET_TIMEOUT time.Duration
	DEBUG          bool
	Hostname       string
}

type Writer

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

A Writer is a connection to a syslog server.

func Dial

func Dial(network, raddr string, priority sg.Priority, s *Settings) (*Writer, error)

Dial establishes a connection to a log daemon by connecting to address raddr on the specified network. Each write to the returned writer sends a log message with the facility and severity (from priority) and tag. If tag is empty, the os.Args[0] is used. If network is empty, Dial will connect to the local syslog server. Otherwise, see the documentation for net.Dial for valid values of network and raddr.

func New

func New(priority sg.Priority, s *Settings) (*Writer, error)

New establishes a new connection to the system log daemon. Each write to the returned writer sends a log message with the given priority (a combination of the syslog facility and severity) and prefix tag. If tag is empty, the os.Args[0] is used.

func (*Writer) Alert

func (w *Writer) Alert(m *string, tag string) error

Alert logs a message with severity LOG_ALERT, ignoring the severity passed to New.

func (*Writer) Close

func (w *Writer) Close() error

Close closes a connection to the syslog daemon.

func (*Writer) Connect

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

func (*Writer) Crit

func (w *Writer) Crit(m *string, tag string) error

Crit logs a message with severity LOG_CRIT, ignoring the severity passed to New.

func (*Writer) Debug

func (w *Writer) Debug(m *string, tag string) error

Debug logs a message with severity LOG_DEBUG, ignoring the severity passed to New.

func (*Writer) Emerg

func (w *Writer) Emerg(m *string, tag string) error

Emerg logs a message with severity LOG_EMERG, ignoring the severity passed to New.

func (*Writer) Err

func (w *Writer) Err(m *string, tag string) error

Err logs a message with severity LOG_ERR, ignoring the severity passed to New.

func (*Writer) Info

func (w *Writer) Info(m *string, tag string) error

Info logs a message with severity LOG_INFO, ignoring the severity passed to New.

func (*Writer) Notice

func (w *Writer) Notice(m *string, tag string) error

Notice logs a message with severity LOG_NOTICE, ignoring the severity passed to New.

func (*Writer) Warning

func (w *Writer) Warning(m *string, tag string) error

Warning logs a message with severity LOG_WARNING, ignoring the severity passed to New.

func (*Writer) Write

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

Write sends a log message to the syslog daemon.

func (*Writer) WritePing

func (w *Writer) WritePing(p sg.Priority, m *string, tag string) error

func (*Writer) WriteSyslog

func (w *Writer) WriteSyslog(p sg.Priority, m *string, tag string) error

Generic interface for sending syslog messages

Jump to

Keyboard shortcuts

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