lets-go:10.2 structured server logging
This commit is contained in:
parent
bf9dcd1247
commit
9c353ced51
@ -67,8 +67,16 @@ func main() {
|
|||||||
sessionManager: sessionManager,
|
sessionManager: sessionManager,
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Info("starting server", slog.String("addr", *addr))
|
srv := &http.Server{
|
||||||
err = http.ListenAndServe(*addr, app.routes())
|
Addr: *addr,
|
||||||
|
Handler: app.routes(),
|
||||||
|
ErrorLog: slog.NewLogLogger(logger.Handler(), slog.LevelError),
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Info("starting server", slog.String("addr", srv.Addr))
|
||||||
|
|
||||||
|
err = srv.ListenAndServe()
|
||||||
|
|
||||||
logger.Error(err.Error())
|
logger.Error(err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user