1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-08 10:45:04 +02:00

Ser ErrorLog for server

This commit is contained in:
DarthSim 2022-07-19 18:04:54 +06:00
parent bb3a9c77f7
commit 9c920bc893

View File

@ -4,6 +4,7 @@ import (
"context"
"crypto/subtle"
"fmt"
golog "log"
"net/http"
"time"
@ -50,10 +51,16 @@ func startServer(cancel context.CancelFunc) (*http.Server, error) {
l = netutil.LimitListener(l, config.MaxClients)
}
errLogger := golog.New(
log.WithField("source", "http_server").WriterLevel(log.ErrorLevel),
"", 0,
)
s := &http.Server{
Handler: buildRouter(),
ReadTimeout: time.Duration(config.ReadTimeout) * time.Second,
MaxHeaderBytes: 1 << 20,
ErrorLog: errLogger,
}
if config.KeepAliveTimeout > 0 {