Documentation ¶
Overview ¶
Package binarylog implementation binary logging as defined in https://github.com/grpc/proposal/blob/master/A16-binary-logging.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Logger *logger
Logger is the global binary logger for the binary. One of this should be built at init time from the configuration (environment varialbe or flags).
It is used to get a methodLogger for each individual method.
Functions ¶
func SetDefaultSink ¶
func SetDefaultSink(s Sink)
SetDefaultSink sets the sink where binary logs will be written to.
Not thread safe. Only set during initialization.
Types ¶
type Cancel ¶
type Cancel struct {
OnClientSide bool
}
Cancel configs the binary log entry to be a Cancel entry.
type ClientHalfClose ¶
type ClientHalfClose struct {
OnClientSide bool
}
ClientHalfClose configs the binary log entry to be a ClientHalfClose entry.
type ClientHeader ¶
type ClientHeader struct { OnClientSide bool Header metadata.MD MethodName string Authority string Timeout time.Duration // PeerAddr is required only when it's on server side. PeerAddr net.Addr }
ClientHeader configs the binary log entry to be a ClientHeader entry.
type ClientMessage ¶
type ClientMessage struct { OnClientSide bool // Message should only be a proto.Message. Could add support for other // message types in the future. Message interface{} }
ClientMessage configs the binary log entry to be a ClientMessage entry.
type LogEntryConfig ¶
type LogEntryConfig interface {
// contains filtered or unexported methods
}
LogEntryConfig represents the configuration for binary log entry.
type MethodLogger ¶
type MethodLogger struct {
// contains filtered or unexported fields
}
MethodLogger is the sub-logger for each method.
func (*MethodLogger) Log ¶
func (ml *MethodLogger) Log(c LogEntryConfig)
Log creates a proto binary log entry, and logs it to the sink.
type ServerHeader ¶
type ServerHeader struct { OnClientSide bool Header metadata.MD // PeerAddr is required only when it's on client side. PeerAddr net.Addr }
ServerHeader configs the binary log entry to be a ServerHeader entry.
type ServerMessage ¶
type ServerMessage struct { OnClientSide bool // Message should only be a proto.Message. Could add support for other // message types in the future. Message interface{} }
ServerMessage configs the binary log entry to be a ServerMessage entry.
type ServerTrailer ¶
type ServerTrailer struct { OnClientSide bool Trailer metadata.MD // Err is the status error. Err error // PeerAddr is required only when it's on client side and the RPC is trailer // only. PeerAddr net.Addr }
ServerTrailer configs the binary log entry to be a ServerTrailer entry.
type Sink ¶
type Sink interface {
Write(*pb.GrpcLogEntry)
}
Sink writes log entry into the binary log sink.
func NewWriterSink ¶
NewWriterSink creates a binary log sink with the given writer.