{"repo":"rodaine/protoslog","free":true,"listed":false,"github":"https://github.com/rodaine/protoslog","clone":"git clone https://github.com/rodaine/protoslog.git","description":"log/slog support for protobufs","language":"Go","stars":17,"topics":["golang","protobuf","protocol-buffers","slog","structured-logging","logging"],"license":"Apache-2.0","category":"dev-tools","readme_excerpt":"protoslog protoslog provides utilities for using protocol buffer messages with the log/slog package introduced in Go 1.21. Example protoslog operates against Protocol Buffer messages. Below, one might have such a User message: protoslog does NOT require any code generation (beyond the output of protoc-gen-go ) to properly log a message: Outputs: Field Value Types Messages are lazily converted into a slog.GroupValue with each of its populated field converted into a slog.Attr with the field name as the key and value produced based on its type (similar to the canonical JSON encoding rules) Scalar Types - bool : slog.BoolValue - floats : slog.Float64Value - bytes : base64 encoded in a slog.StringValue - string : slog.StringValue - enum : slog.StringValue of the value name if it's defined, or slog.Int64Value otherwise - signed integer : slog.Int64Value - unsigned integer : slog.Uint64Value Composite Types Populated composite fields are encoded as a slog.GroupValue : - message : each field converted into a slog.Attr with its name as the key and the value recursively applying these rules - repeated : each item converted into a slog.Attr with its index string-ified as the key and the value recursively applying these rules - map : each entry converted into a slog.Attr with its key string-ified and the value recursively applying these rules Well-Known Types (WKTs) Similar to the canonical JSON encoding, some of the WKTs produce special-cased slog.Value : - google.protobuf.NullValue : e","default_branch":null,"files":null,"tree":[],"storefront":"/r/rodaine","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/rodaine/protoslog/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}