INNER CODE UNIT · Go

accessLogger

ContainerSolutions/k8s-deployment-strategies · app/main.go:130

func accessLogger(r *http.Request, status, size int, dur time.Duration) {
	hlog.FromRequest(r).Info().
		Str("host", r.Host).
		Int("status", status).
		Int("size", size).
		Dur("duration_ms", dur).
		Msg("request")
}

func serveHTTP(srv *http.Server) {
	log.Info().Msgf("Server started at %s", srv.Addr)
	err := srv.ListenAndServe()

	if err != http.ErrServerClosed {
		log.Fatal().Err(err).Msgf("Listen: %s\n", err)
	}
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…