Documentation ¶
Index ¶
- func NewLogger(p Priority, logFlag int) (*log.Logger, error)
- type Priority
- type Writer
- func Dial(network, raddr string, priority Priority, tag string) (*Writer, error)
- func DialWithTLSCertPath(network, raddr string, priority Priority, tag, certPath string) (*Writer, error)
- func DialWithTLSConfig(network, raddr string, priority Priority, tag string, tlsConfig *tls.Config) (*Writer, error)
- func New(priority Priority, tag string) (w *Writer, err error)
- func (w *Writer) Alert(m string) (err error)
- func (w *Writer) Close() error
- func (w *Writer) Crit(m string) (err error)
- func (w *Writer) Debug(m string) (err error)
- func (w *Writer) Emerg(m string) (err error)
- func (w *Writer) Err(m string) (err error)
- func (w *Writer) Info(m string) (err error)
- func (w *Writer) Notice(m string) (err error)
- func (w *Writer) Warning(m string) (err error)
- func (w *Writer) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Priority ¶
type Priority int
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 ¶
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. If network is empty, Dial will connect to the local syslog server.
func DialWithTLSCertPath ¶
func DialWithTLSCertPath(network, raddr string, priority Priority, tag, certPath string) (*Writer, error)
DialWithTLSCertPath establishes a secure connection to a log daemon by connecting to address raddr on the specified network. It uses certPath to load TLS certificates and configure the secure connection.
func DialWithTLSConfig ¶
func DialWithTLSConfig(network, raddr string, priority Priority, tag string, tlsConfig *tls.Config) (*Writer, error)
DialWithTLSConfig establishes a secure connection to a log daemon by connecting to address raddr on the specified network. It uses tlsConfig to configure the secure connection.
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 and prefix.
func (*Writer) Alert ¶
Alert logs a message with severity LOG_ALERT; this overrides the default priority passed to `srslog.New` and the `srslog.Dial*` functions.
func (*Writer) Crit ¶
Crit logs a message with severity LOG_CRIT; this overrides the default priority passed to `srslog.New` and the `srslog.Dial*` functions.
func (*Writer) Debug ¶
Debug logs a message with severity LOG_DEBUG; this overrides the default priority passed to `srslog.New` and the `srslog.Dial*` functions.
func (*Writer) Emerg ¶
Emerg logs a message with severity LOG_EMERG; this overrides the default priority passed to `srslog.New` and the `srslog.Dial*` functions.
func (*Writer) Err ¶
Err logs a message with severity LOG_ERR; this overrides the default priority passed to `srslog.New` and the `srslog.Dial*` functions.
func (*Writer) Info ¶
Info logs a message with severity LOG_INFO; this overrides the default priority passed to `srslog.New` and the `srslog.Dial*` functions.
func (*Writer) Notice ¶
Notice logs a message with severity LOG_NOTICE; this overrides the default priority passed to `srslog.New` and the `srslog.Dial*` functions.