You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
flc1125
changed the title
log/syslog: Discussion of connect() connections for Dial (or alternative)
proposal: log/syslog: Discussion of connect() connections for Dial (or alternative)
Nov 21, 2023
package syslog_test
import (
"log""log/syslog"
)
funcmain() {
// If host:port is actually unavailablesyslog, err:=syslog.Open("tcp", "host:port", syslog.LOG_WARNING|syslog.LOG_DAEMON, "tag")
iferr!=nil {
log.Fatal(err) // <----- There will be nil
}
iferr:=syslog.Ping(); err!=nil {
log.Fatal(err) // <----- There will be an error
}
syslog.Info("This is a daemon warning with tag.")
}
seankhliao
changed the title
proposal: log/syslog: Discussion of connect() connections for Dial (or alternative)
proposal: log/syslog: Open() to construct logger without connecting
Dec 8, 2023
As a continuation of #64165 (comment).
I don't think connect should establish a connection in
Dial
, but to ensure that it's available, consider adding aPing
to verify it.Of course, for backward compatibility, we can not adjust the original function of
Dial
, we can add a new method, such asOpen
to solve this problem.The text was updated successfully, but these errors were encountered: