Source file src/cmd/vendor/golang.org/x/tools/go/analysis/passes/slog/doc.go
1 // Copyright 2023 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. 4 5 // Package slog defines an Analyzer that checks for 6 // mismatched key-value pairs in log/slog calls. 7 // 8 // # Analyzer slog 9 // 10 // slog: check for invalid structured logging calls 11 // 12 // The slog checker looks for calls to functions from the log/slog 13 // package that take alternating key-value pairs. It reports calls 14 // where an argument in a key position is neither a string nor a 15 // slog.Attr, and where a final key is missing its value. 16 // For example,it would report 17 // 18 // slog.Warn("message", 11, "k") // slog.Warn arg "11" should be a string or a slog.Attr 19 // 20 // and 21 // 22 // slog.Info("message", "k1", v1, "k2") // call to slog.Info missing a final value 23 package slog 24