- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for argsToAttr (0.18 sec)
-
src/log/slog/record.go
return n } const badKey = "!BADKEY" // argsToAttr turns a prefix of the nonempty args slice into an Attr // and returns the unconsumed portion of the slice. // If args[0] is an Attr, it returns it. // If args[0] is a string, it treats the first two elements as // a key-value pair. // Otherwise, it treats args[0] as a value with a missing key. func argsToAttr(args []any) (Attr, []any) { switch x := args[0].(type) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Nov 08 16:30:56 UTC 2023 - 6K bytes - Viewed (0) -
src/log/slog/attr.go
return Attr{key, GroupValue(argsToAttrSlice(args)...)} } func argsToAttrSlice(args []any) []Attr { var ( attr Attr attrs []Attr ) for len(args) > 0 { attr, args = argsToAttr(args) attrs = append(attrs, attr) } return attrs } // Any returns an Attr for the supplied value. // See [AnyValue] for how values are treated. func Any(key string, value any) Attr {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Mar 25 18:23:25 UTC 2024 - 2.5K bytes - Viewed (0)