MCPcopy Index your code
hub / github.com/coder/coder / slogError

Function slogError

scripts/rules.go:440–447  ·  view source on GitHub ↗

slogErr ensures that errors are logged with "slog.Error" instead of "slog.F"

(m dsl.Matcher)

Source from the content-addressed store, hash-verified

438
439// slogErr ensures that errors are logged with "slog.Error" instead of "slog.F"
440func slogError(m dsl.Matcher) {
441 m.Import("cdr.dev/slog/v3")
442 m.Match(
443 `slog.F($name, $value)`,
444 ).
445 Where(m["name"].Const && m["value"].Type.Is("error") && !m["name"].Text.Matches(`^"internal_error"$`)).
446 Report(`Error should be logged using "slog.Error" instead.`)
447}
448
449// withTimezoneUTC ensures that we don't just sprinkle dbtestutil.WithTimezone("UTC") about
450// to work around real timezone bugs in our code.

Callers

nothing calls this directly

Calls 4

MatchMethod · 0.80
ReportMethod · 0.65
IsMethod · 0.45
MatchesMethod · 0.45

Tested by

no test coverage detected