2021-11-15 19:09:07 +00:00
|
|
|
//go:build !windows
|
2021-11-22 14:09:03 +00:00
|
|
|
// +build !windows
|
2020-10-13 22:02:55 +00:00
|
|
|
|
2021-03-25 19:30:36 +00:00
|
|
|
package logger
|
2020-10-13 22:02:55 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
native "log/syslog"
|
|
|
|
)
|
|
|
|
|
|
|
|
type syslog struct {
|
|
|
|
inner *native.Writer
|
|
|
|
}
|
|
|
|
|
2023-05-04 18:16:41 +00:00
|
|
|
func newSysLog(prefix string) (io.WriteCloser, error) {
|
2020-10-13 22:02:55 +00:00
|
|
|
inner, err := native.New(native.LOG_INFO|native.LOG_DAEMON, prefix)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &syslog{
|
|
|
|
inner: inner,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ls *syslog) Close() error {
|
|
|
|
return ls.inner.Close()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ls *syslog) Write(p []byte) (int, error) {
|
|
|
|
return ls.inner.Write(p)
|
|
|
|
}
|