Skip to content

Commit

Permalink
webapi: Move "listening" log to server start.
Browse files Browse the repository at this point in the history
Moving this log closer to where the server is actually started reduces
the chance of confusion. Also, logging the parsed listener.Addr() string
instead of the provided config string provides extra debugging detail.
  • Loading branch information
jholdstock committed Sep 16, 2023
1 parent f82e568 commit c3a9697
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/webapi/webapi.go
Expand Up @@ -120,7 +120,6 @@ func New(vdb *database.VspDatabase, log slog.Logger, dcrd rpc.DcrdConnect,
if err != nil {
return nil, err
}
log.Infof("Listening on %s", cfg.Listen)

w := &WebAPI{
cfg: cfg,
Expand Down Expand Up @@ -163,6 +162,7 @@ func (w *WebAPI) Run(ctx context.Context) {
// Start webserver.
wg.Add(1)
go func() {
w.log.Infof("Listening on %s", w.listener.Addr())
err := w.server.Serve(w.listener)
// ErrServerClosed is expected from a graceful server shutdown, it can
// be ignored. Anything else should be logged.
Expand Down

0 comments on commit c3a9697

Please sign in to comment.