feat(oohelperd): log messages at info level (#896)

We're using a request-specific logger where we also print the ID
of the request. This design helps to observe logs produced by
concurrent requests.

Part of https://github.com/ooni/probe/issues/2183

While there, fix https://github.com/ooni/probe/issues/2241
This commit is contained in:
Simone Basso 2022-08-28 22:26:58 +02:00 committed by GitHub
commit 4241ee4bc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 225 additions and 27 deletions

View file

@ -10,6 +10,7 @@ import (
"io"
"net/http"
"github.com/ooni/probe-cli/v3/internal/atomicx"
"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/netxlite"
"github.com/ooni/probe-cli/v3/internal/runtimex"
@ -18,20 +19,26 @@ import (
// handler implements the Web Connectivity test helper HTTP API.
type handler struct {
// BaseLogger is the MANDATORY logger to use.
BaseLogger model.Logger
// Indexer is the MANDATORY atomic integer used to assign an index to requests.
Indexer *atomicx.Int64
// MaxAcceptableBody is the MANDATORY maximum acceptable response body.
MaxAcceptableBody int64
// NewClient is the MANDATORY factory to create a new HTTPClient.
NewClient func() model.HTTPClient
NewClient func(model.Logger) model.HTTPClient
// NewDialer is the MANDATORY factory to create a new Dialer.
NewDialer func() model.Dialer
NewDialer func(model.Logger) model.Dialer
// NewResolver is the MANDATORY factory for creating a new resolver.
NewResolver func() model.Resolver
NewResolver func(model.Logger) model.Resolver
// NewTLSHandshaker is the MANDATORY factory for creating a new TLS handshaker.
NewTLSHandshaker func() model.TLSHandshaker
NewTLSHandshaker func(model.Logger) model.TLSHandshaker
}
var _ http.Handler = &handler{}