Say the query logger drops bound values #551
@@ -146,7 +146,7 @@ func openDB(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// assertBounded holds every line the adapter wrote to the stated
|
// assertBounded holds every line the adapter wrote to the stated
|
||||||
// ceiling and proves each was cut rather than merely short.
|
// ceiling and proves no line carried a whole client value.
|
||||||
func assertBounded(t *testing.T, out string) {
|
func assertBounded(t *testing.T, out string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
|
|||||||
@@ -191,13 +191,12 @@ func receiverRouter(h *handlers.Handlers) *chi.Mux {
|
|||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|
||||||
// postReceiver sends one POST at /h/<segment>.
|
// postReceiver sends one POST with an empty body at /h/<segment>
|
||||||
|
// through router and returns the response status.
|
||||||
//
|
//
|
||||||
// RawPath is cleared after parsing so chi routes on the decoded path
|
// RawPath is cleared after parsing so chi routes on the decoded path
|
||||||
// and the handler sees the raw bytes rather than their percent-escaped
|
// and the handler sees the raw bytes rather than their percent-escaped
|
||||||
// spelling. That is the harder case for the budget: the escaped
|
// spelling.
|
||||||
// spelling is plain ASCII, which costs one byte per byte, while the
|
|
||||||
// decoded bytes are what the log handler has to escape.
|
|
||||||
func postReceiver(
|
func postReceiver(
|
||||||
t *testing.T, router *chi.Mux, segment string,
|
t *testing.T, router *chi.Mux, segment string,
|
||||||
) int {
|
) int {
|
||||||
|
|||||||
@@ -115,16 +115,15 @@ const (
|
|||||||
// a caller on a parameterised route would supply, which is the
|
// a caller on a parameterised route would supply, which is the
|
||||||
// only way those caps can be pinned at all.
|
// only way those caps can be pinned at all.
|
||||||
//
|
//
|
||||||
// One writer in that set is not a handler's own slog call. The
|
// The GORM adapter in internal/gormlog writes through slog as well.
|
||||||
// GORM adapter in internal/gormlog logs the statement with the
|
// It logs each statement with its placeholders rather than the
|
||||||
// client-chosen parameter already interpolated into it, which on
|
// values bound to them (see its ParamsFilter), so the key a client
|
||||||
// the receiver and login lookups is exactly the value the budgets
|
// sends to the receiver or login lookup does not reach its lines.
|
||||||
// above exist for. Its widest line spends two logfield.MaxBytes
|
// Its widest line spends two logfield.MaxBytes budgets — the
|
||||||
// budgets — the statement and the driver error — against a fixed
|
// statement and the driver error — against a fixed portion smaller
|
||||||
// portion smaller than this one's, and
|
// than this one's, and internal/gormlog/gormlog_test.go asserts
|
||||||
// internal/gormlog/gormlog_test.go asserts every line it emits
|
// every line it emits against this constant directly rather than
|
||||||
// against this constant directly rather than leaving it as
|
// leaving it as arithmetic.
|
||||||
// arithmetic.
|
|
||||||
//
|
//
|
||||||
// What it does NOT cover, so that the figure above is not read as
|
// What it does NOT cover, so that the figure above is not read as
|
||||||
// more than it is:
|
// more than it is:
|
||||||
|
|||||||
Reference in New Issue
Block a user