From 0480e066a3f1ae97dbab8fcb6303589eb0fa724c Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 23 Jan 2023 22:15:16 -0700 Subject: logging library up to top level --- gemini/serve.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gemini/serve.go') diff --git a/gemini/serve.go b/gemini/serve.go index c148558..cd51370 100644 --- a/gemini/serve.go +++ b/gemini/serve.go @@ -8,10 +8,12 @@ import ( "sync" "tildegit.org/tjp/gus" + "tildegit.org/tjp/gus/logging" ) type server struct { ctx context.Context + errorLog logging.Logger network string address string cancel context.CancelFunc @@ -23,6 +25,7 @@ type server struct { // NewServer builds a gemini server. func NewServer( ctx context.Context, + errorLog logging.Logger, tlsConfig *tls.Config, network string, address string, @@ -37,6 +40,7 @@ func NewServer( s := &server{ ctx: ctx, + errorLog: errorLog, network: addr.Network(), address: addr.String(), wg: &sync.WaitGroup{}, @@ -69,7 +73,10 @@ func (s *server) Serve() error { if err != nil { if s.Closed() { err = nil + } else { + s.errorLog.Log("msg", "accept_error", "error", err) } + return err } -- cgit v1.2.3