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

提供指定http.Server的ErrorLog功能 #77

Open
Jardaliao opened this issue Dec 15, 2023 · 1 comment
Open

提供指定http.Server的ErrorLog功能 #77

Jardaliao opened this issue Dec 15, 2023 · 1 comment

Comments

@Jardaliao
Copy link
Contributor

What would you like to be added:
提供指定http.Server的ErrorLog功能

Why is this needed:
http.Server的错误日志默认会写到标准输出,但它提供了指定自定义Logger的口子,getty似乎没有开放这个口子?

http\server.go

type Server struct {
        // ErrorLog specifies an optional logger for errors accepting
	// connections, unexpected behavior from handlers, and
	// underlying FileSystem errors.
	// If nil, logging is done via the log package's standard logger.
	ErrorLog *log.Logger
}
getty\options.go

type ServerOptions struct {
	addr string
	// tls
	sslEnabled       bool
	tlsConfigBuilder TlsConfigBuilder
	// websocket
	path       string
	cert       string
	privateKey string
	caCert     string
	// task queue
	tPool gxsync.GenericTaskPool
}
@AlexStocks
Copy link
Owner

AlexStocks commented Dec 15, 2023

image

如上图,可以对你用的 logger 封装下,然后调用  SetLogger 这个接口函数即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants