1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
9 "log/slog/internal/testutil"
16 r, _ := http.NewRequest("GET", "localhost", nil)
19 logger := slog.New(slog.HandlerOptions{ReplaceAttr: testutil.RemoveTime}.NewTextHandler(os.Stdout))
20 slog.SetDefault(logger)
24 slog.String("method", r.Method),
25 slog.String("url", r.URL.String())),
26 slog.Int("status", http.StatusOK),
27 slog.Duration("duration", time.Second))
30 // level=INFO msg=finished req.method=GET req.url=localhost status=200 duration=1s