openpdu/src/syslog.go

25 lines
468 B
Go

package main
import (
"log"
syslog "github.com/RackSec/srslog"
)
func init() {
w, err := syslog.Dial("", "", syslog.LOG_ERR, "testtag")
if err != nil {
log.Fatal("failed to connect to syslog:", err)
}
defer w.Close()
w.Alert("this is an alert")
w.Crit("this is critical")
w.Err("this is an error")
w.Warning("this is a warning")
w.Notice("this is a notice")
w.Info("this is info")
w.Debug("this is debug")
w.Write([]byte("these are some bytes"))
}