Skip to content

Commit

Permalink
made init log more useful
Browse files Browse the repository at this point in the history
and also remove useless old debug log
  • Loading branch information
Southclaws committed Oct 21, 2023
1 parent 64bbe5b commit c2b517e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions internal/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,20 @@ func NewServer(lc fx.Lifecycle, l *zap.Logger, cfg config.Config, router *http.S

lc.Append(fx.Hook{
OnStart: func(_ context.Context) error {
l.Info("http server starting", zap.String("address", cfg.ListenAddr))
server.BaseContext = func(ln net.Listener) context.Context { return wctx }
go func() {
// The HTTP server is the root node of dependency tree, because
// it depends on everything else being initialised first. So, if
// the app reaches this point, its considered a successful boot!

l.Info("storyden http server starting",
zap.String("address", cfg.ListenAddr),
zap.String("cookie_domain", cfg.CookieDomain),
zap.String("frontend_address", cfg.PublicWebAddress),
zap.Bool("frontend_address", cfg.Production),
zap.String("log_level", cfg.LogLevel.String()),
)

if err := server.ListenAndServe(); err != nil {
l.Fatal("http server stopped unexpectedly", zap.Error(err))
}
Expand All @@ -36,7 +47,5 @@ func NewServer(lc fx.Lifecycle, l *zap.Logger, cfg config.Config, router *http.S
},
})

l.Info("created http server")

return server
}

1 comment on commit c2b517e

@vercel
Copy link

@vercel vercel bot commented on c2b517e Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.