Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: log/syslog: Open() to construct logger without connecting #64298

Open
flc1125 opened this issue Nov 21, 2023 · 3 comments
Open

proposal: log/syslog: Open() to construct logger without connecting #64298

flc1125 opened this issue Nov 21, 2023 · 3 comments
Labels
Milestone

Comments

@flc1125
Copy link

flc1125 commented Nov 21, 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 a Ping to verify it.

Of course, for backward compatibility, we can not adjust the original function of Dial, we can add a new method, such as Open to solve this problem.

@flc1125 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
@gopherbot gopherbot added this to the Proposal milestone Nov 21, 2023
@seankhliao
Copy link
Member

We don't use the issue tracker for discussions.
What's being proposed here?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 21, 2023
@flc1125
Copy link
Author

flc1125 commented Nov 22, 2023

Example: https://github.com/golang/go/pull/64326/files

package syslog_test

import (
	"log"
	"log/syslog"
)

func main() {
        // If host:port is actually unavailable
	syslog, err := syslog.Open("tcp", "host:port", syslog.LOG_WARNING|syslog.LOG_DAEMON, "tag")
	if err != nil {
		log.Fatal(err)   // <-----  There will be nil
	}

	if err := syslog.Ping(); err != nil {
		log.Fatal(err)  // <-----  There will be an error
	}

	syslog.Info("This is a daemon warning with tag.")
}

@flc1125

This comment was marked as resolved.

@seankhliao seankhliao removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 23, 2023
@seankhliao 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

3 participants