modulepackage
1.0.6
Repository: https://github.com/nvx/go-proto-logfields.git
Documentation: pkg.go.dev
# README
go-proto-logfields
A protoc plugin for generating log field extractors.
Use-case
It is useful to augment log messages with additional context from the execution environment. For example, when handling an RPC, it may be useful to add some fields of the request message to any messages logged while handling the request.
Install
- Install Go.
- Install
protoc
andprotoc-gen-go
, and ensure they are in your path. go install github.com/nvx/go-proto-logfields/protoc-gen-gologfields@latest
Usage
Given a an RPC:
syntax = "proto3";
package doer_of_something;
import "logfields.proto";
Service Doer {
rpc DoSomething (SomethingRequest) returns (SomethingResponse) {}
}
The request might be annotated as such:
message SomethingRequest {
string what = 1 [(improbable.logfield) = {name: "what_was_requested"}];
}
The logfields extractor can be generated with buf.build using buf generate. See the
buf.yamland
buf.gen.yaml` files in this repository for an example.
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
# Variables
logfield indicates if and how the annotated field should be included as context in log messages.
No description provided by the author