diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-01-23 22:15:16 -0700 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-01-23 22:15:16 -0700 |
commit | 0480e066a3f1ae97dbab8fcb6303589eb0fa724c (patch) | |
tree | 1aa347eb3691a29987475fcf6049343aa227a365 /gemini/serve.go | |
parent | df57a12539030297b3254bc81f5696691cbc9c6f (diff) |
logging library up to top level
Diffstat (limited to 'gemini/serve.go')
-rw-r--r-- | gemini/serve.go | 7 |
1 files changed, 7 insertions, 0 deletions
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 } |