diff --git a/main.go b/main.go index a984311dbd341c89c352cace4603c727f8ba4124..d80c4216f5473f8732651657582c04fac29c15c0 100644 --- a/main.go +++ b/main.go @@ -16,13 +16,6 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/metrics" ) -func init() { - _, err := maxprocs.Set() - if err != nil { - log.WithError(err).Error("could not set automaxprocs") - } -} - // VERSION stores the information about the semantic version of application var VERSION = "dev" @@ -95,6 +88,11 @@ func printVersion(showVersion bool, version string) { } func main() { + _, err := maxprocs.Set() + if err != nil { + log.WithError(err).Error("could not set automaxprocs") + } + logrus.SetOutput(os.Stderr) metrics.MustRegister() diff --git a/server.go b/server.go index 9d667157d852da38f44e8acec9bfc187a5160e15..5b2502c64ae68ebc4b54cf405c0222b6f524bf54 100644 --- a/server.go +++ b/server.go @@ -4,14 +4,14 @@ import ( "context" "crypto/tls" "fmt" - stdlog "log" + "log" + "log/slog" "net" "net/http" + "os" "path/filepath" "github.com/pires/go-proxyproto" - "github.com/sirupsen/logrus" - "gitlab.com/gitlab-org/labkit/log" "gitlab.com/gitlab-org/gitlab-pages/internal/netutil" ) @@ -27,7 +27,7 @@ func newHTTPServer(a *theApp) *http.Server { ReadTimeout: a.config.Server.ReadTimeout, ReadHeaderTimeout: a.config.Server.ReadHeaderTimeout, WriteTimeout: a.config.Server.WriteTimeout, - ErrorLog: stdlog.New(logrus.StandardLogger().Writer(), "", 0), + ErrorLog: log.New(os.Stdout, "", 0), } } @@ -74,10 +74,9 @@ func (a *theApp) listenAndServe(server *http.Server, addr string, h http.Handler l = tls.NewListener(l, server.TLSConfig) } - log.WithFields(log.Fields{ - "config_addr": addr, - "listen_addr": l.Addr(), - }).Infof("server listening on: %s", l.Addr()) + slog.Info( + fmt.Sprintf("server listening on %s", l.Addr()), + ) return server.Serve(l) }