Documentation ¶
Overview ¶
Package syslog provides a simple interface to the system log service. It can send messages to the syslog daemon using UNIX domain sockets, 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.
The syslog package is frozen and is not accepting new features. Some external packages provide more functionality. See:
https://godoc.org/?q=syslog
Index ¶
- func NewLogger(p syslog.Priority, logFlag int) (*log.Logger, error)
- 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)
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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 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 DialTLS ¶
func DialTLS(network, raddr string, priority syslog.Priority, tag string, conf *tls.Config) (*Writer, error)
DialTLS dials and does a TLS client handshake.
func New ¶
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 ¶
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.
Notes ¶
Bugs ¶
This package is not implemented on Windows. As the syslog package is frozen, Windows users are encouraged to use a package outside of the standard library. For background, see https://golang.org/issue/1108.
This package is not implemented on Plan 9.
This package is not implemented on NaCl (Native Client).