package binarylog

Import Path
	google.golang.org/grpc/internal/binarylog (on go.dev)

Dependency Relation
	imports 21 packages, and imported by one package

Involved Source Files Package binarylog implementation binary logging as defined in https://github.com/grpc/proposal/blob/master/A16-binary-logging.md. binarylog_testutil.go env_config.go method_logger.go sink.go
Package-Level Type Names (total 17, in which 11 are exported)
/* sort exporteds by: | */
Cancel configs the binary log entry to be a Cancel entry. OnClientSide bool *T : LogEntryConfig
ClientHalfClose configs the binary log entry to be a ClientHalfClose entry. OnClientSide bool *T : LogEntryConfig
ClientHeader configs the binary log entry to be a ClientHeader entry. Authority string Header metadata.MD MethodName string OnClientSide bool PeerAddr is required only when it's on server side. Timeout time.Duration *T : LogEntryConfig
ClientMessage configs the binary log entry to be a ClientMessage entry. Message can be a proto.Message or []byte. Other messages formats are not supported. OnClientSide bool *T : LogEntryConfig
LogEntryConfig represents the configuration for binary log entry. *Cancel *ClientHalfClose *ClientHeader *ClientMessage *ServerHeader *ServerMessage *ServerTrailer func (*MethodLogger).Log(c LogEntryConfig)
Logger is the global binary logger. It can be used to get binary logger for each method. func NewLoggerFromConfigString(s string) Logger func SetLogger(l Logger) var AllLogger
MethodLogger is the sub-logger for each method. Log creates a proto binary log entry, and logs it to the sink. func GetMethodLogger(methodName string) *MethodLogger
ServerHeader configs the binary log entry to be a ServerHeader entry. Header metadata.MD OnClientSide bool PeerAddr is required only when it's on client side. *T : LogEntryConfig
ServerMessage configs the binary log entry to be a ServerMessage entry. Message can be a proto.Message or []byte. Other messages formats are not supported. OnClientSide bool *T : LogEntryConfig
ServerTrailer configs the binary log entry to be a ServerTrailer entry. Err is the status error. OnClientSide bool PeerAddr is required only when it's on client side and the RPC is trailer only. Trailer metadata.MD *T : LogEntryConfig
Sink writes log entry into the binary log sink. Close will be called when the Sink is replaced by a new Sink. Write will be called to write the log entry into the sink. It should be thread-safe so it can be called in parallel. T : io.Closer func NewTempFileSink() (Sink, error) func SetDefaultSink(s Sink)
Package-Level Functions (total 15, in which 5 are exported)
GetMethodLogger returns the methodLogger for the given methodName. methodName should be in the format of "/service/method". Each methodLogger returned by this method is a new instance. This is to generate sequence id within the call.
NewLoggerFromConfigString reads the string and build a logger. It can be used to build a new logger and assign it to binarylog.Logger. Example filter config strings: - "" Nothing will be logged - "*" All headers and messages will be fully logged. - "*{h}" Only headers will be logged. - "*{m:256}" Only the first 256 bytes of each message will be logged. - "Foo/*" Logs every method in service Foo - "Foo/*,-Foo/Bar" Logs every method in service Foo except method /Foo/Bar - "Foo/*,Foo/Bar{m:256}" Logs the first 256 bytes of each message in method /Foo/Bar, logs all headers and messages in every other method in service Foo. If two configs exist for one certain method or service, the one specified later overrides the previous config.
NewTempFileSink creates a temp file and returns a Sink that writes to this file.
SetDefaultSink sets the sink where binary logs will be written to. Not thread safe. Only set during initialization.
SetLogger sets the binarg logger. Only call this at init time.
Package-Level Variables (total 11, in which 3 are exported)
AddrToProto converts an address to a binary logging proto message. It's for testing only.
AllLogger is a logger that logs all headers/messages for all RPCs. It's for testing only.
MdToMetadataProto converts metadata to a binary logging proto message. It's for testing only.
Package-Level Constants (total 7, none are exported)