Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
147d58dd96 |
@@ -146,7 +146,7 @@ func openDB(
|
||||
}
|
||||
|
||||
// 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) {
|
||||
t.Helper()
|
||||
|
||||
|
||||
@@ -191,13 +191,12 @@ func receiverRouter(h *handlers.Handlers) *chi.Mux {
|
||||
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
|
||||
// and the handler sees the raw bytes rather than their percent-escaped
|
||||
// spelling. That is the harder case for the budget: the escaped
|
||||
// spelling is plain ASCII, which costs one byte per byte, while the
|
||||
// decoded bytes are what the log handler has to escape.
|
||||
// spelling.
|
||||
func postReceiver(
|
||||
t *testing.T, router *chi.Mux, segment string,
|
||||
) int {
|
||||
|
||||
@@ -115,16 +115,15 @@ const (
|
||||
// a caller on a parameterised route would supply, which is the
|
||||
// only way those caps can be pinned at all.
|
||||
//
|
||||
// One writer in that set is not a handler's own slog call. The
|
||||
// GORM adapter in internal/gormlog logs the statement with the
|
||||
// client-chosen parameter already interpolated into it, which on
|
||||
// the receiver and login lookups is exactly the value the budgets
|
||||
// above exist for. Its widest line spends two logfield.MaxBytes
|
||||
// budgets — the statement and the driver error — against a fixed
|
||||
// portion smaller than this one's, and
|
||||
// internal/gormlog/gormlog_test.go asserts every line it emits
|
||||
// against this constant directly rather than leaving it as
|
||||
// arithmetic.
|
||||
// The GORM adapter in internal/gormlog writes through slog as well.
|
||||
// It logs each statement with its placeholders rather than the
|
||||
// values bound to them (see its ParamsFilter), so the key a client
|
||||
// sends to the receiver or login lookup does not reach its lines.
|
||||
// Its widest line spends two logfield.MaxBytes budgets — the
|
||||
// statement and the driver error — against a fixed portion smaller
|
||||
// than this one's, and internal/gormlog/gormlog_test.go asserts
|
||||
// every line it emits against this constant directly rather than
|
||||
// leaving it as arithmetic.
|
||||
//
|
||||
// What it does NOT cover, so that the figure above is not read as
|
||||
// more than it is:
|
||||
|
||||
Reference in New Issue
Block a user