aboutsummaryrefslogtreecommitdiffstats
path: root/logging/http
diff options
context:
space:
mode:
Diffstat (limited to 'logging/http')
-rw-r--r--logging/http/http_test.go16
1 files changed, 5 insertions, 11 deletions
diff --git a/logging/http/http_test.go b/logging/http/http_test.go
index 832b49e..e12b9b2 100644
--- a/logging/http/http_test.go
+++ b/logging/http/http_test.go
@@ -80,20 +80,14 @@ func TestNew(t *testing.T) {
t.Fatalf("expected 1 log record, got %d", len(records))
}
- record := records[0]
-
- attrs := map[string]slog.Value{}
- record.Attrs(func(a slog.Attr) bool {
- attrs[a.Key] = a.Value
- return true
- })
+ attrs := records[0]
method := attrs["method"]
- if got := method.String(); got != tt.method {
+ if got := method.(string); got != tt.method {
t.Fatalf("expected %v log record, got %v", tt.method, got)
}
status := attrs["status"]
- if got := int(status.Int64()); got != tt.status {
+ if got := int(status.(int64)); got != tt.status {
t.Fatalf("expected %v log record, got %v", tt.status, got)
}
@@ -103,11 +97,11 @@ func TestNew(t *testing.T) {
}
host := attrs["host"]
- if got := host.String(); got != url.Host {
+ if got := host.(string); got != url.Host {
t.Fatalf("expected %v log record, got %v", url.Host, got)
}
path := attrs["path"]
- if got := path.String(); got != url.RequestURI() {
+ if got := path.(string); got != url.RequestURI() {
t.Fatalf("expected %v log record, got %v", url.RequestURI(), got)
}
})