-
|
Hi, We want to directly send logs from golang slog logger to flowg syslog service. We are using https://github.com/samber/slog-syslog for log adapter. We are not able to make it work. package main
import (
"log"
"log/slog"
"net"
slogsyslog "github.com/samber/slog-syslog/v2"
)
func main() {
writer, err := net.Dial("udp", "127.0.0.1:5514")
if err != nil {
log.Fatal(err)
}
logger := slog.New(slogsyslog.Option{Level: slog.LevelDebug, Writer: writer}.NewSyslogHandler())
slog.SetDefault(logger)
slog.Info("fdfdfdfdf", "sdsd", "sdsd")
}
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Thank you for the report, I did manage to reproduce the issue on the current main branch, I opened a bug report and added it to the roadmap. We'll have a look as quickly as possible. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Thanks a lot! It works well with simple log/syslog. package main
import (
"fmt"
"log"
"log/syslog"
)
func main() {
sysLog, err := syslog.Dial("udp", "localhost:5514",
syslog.LOG_WARNING|syslog.LOG_DAEMON, "demotag")
if err != nil {
log.Fatal(err)
}
fmt.Fprintf(sysLog, "This is a daemon warning with demotag.")
sysLog.Emerg("And this is a daemon emergency with demotag.")
} |
Beta Was this translation helpful? Give feedback.
-
|
I'm closing the issue (and this discussion) as this is a problem with the |
Beta Was this translation helpful? Give feedback.
#1021