Documentation ¶
Overview ¶
Package syslog provides a simple interface to the system log service. It can send messages to the syslog daemon using UDP or TCP.
Only one call to Dial is necessary. On write failures, the syslog client will attempt to reconnect to the server and write again.
Index ¶
- type Priority
- type Writer
- func (w *Writer) Alert(m string) error
- func (w *Writer) Close() error
- func (w *Writer) Crit(m string) error
- func (w *Writer) Debug(m string) error
- func (w *Writer) Emerg(m string) error
- func (w *Writer) Err(m string) error
- func (w *Writer) Info(m string) error
- func (w *Writer) Notice(m string) error
- func (w *Writer) Warning(m string) error
- func (w *Writer) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Priority ¶
type Priority int
The Priority is a combination of the syslog facility and severity. For example, LOG_ALERT | LOG_FTP sends an alert severity message from the FTP facility. The default severity is LOG_EMERG; the default facility is LOG_KERN.
const ( // From /usr/include/sys/syslog.h. // These are the same up to LOG_FTP on Linux, BSD, and OS X. LOG_KERN 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 )
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
A Writer is a connection to a syslog server.
func Dial ¶
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 given facility, severity and tag.
func DialHostname ¶
func (*Writer) Alert ¶
Alert logs a message with severity LOG_ALERT, ignoring the severity passed to New.
func (*Writer) Crit ¶
Crit logs a message with severity LOG_CRIT, ignoring the severity passed to New.
func (*Writer) Debug ¶
Debug logs a message with severity LOG_DEBUG, ignoring the severity passed to New.
func (*Writer) Emerg ¶
Emerg logs a message with severity LOG_EMERG, ignoring the severity passed to New.
func (*Writer) Info ¶
Info logs a message with severity LOG_INFO, ignoring the severity passed to New.
func (*Writer) Notice ¶
Notice logs a message with severity LOG_NOTICE, ignoring the severity passed to New.