Source File
binarylog.go
Belonging Package
google.golang.org/grpc/internal/binarylog
package binarylog
import (
)
type Logger interface {
getMethodLogger(methodName string) *MethodLogger
}
var binLogger Logger
var grpclogLogger = grpclog.Component("binarylog")
func ( string) *MethodLogger {
if binLogger == nil {
return nil
}
return binLogger.getMethodLogger()
}
func () {
const = "GRPC_BINARY_LOG_FILTER"
:= os.Getenv()
binLogger = NewLoggerFromConfigString()
}
hdr, msg uint64
}
type logger struct {
all *methodLoggerConfig
services map[string]*methodLoggerConfig
methods map[string]*methodLoggerConfig
blacklist map[string]struct{}
}
func ( *logger) ( string, *methodLoggerConfig) error {
if , := .blacklist[]; {
return fmt.Errorf("conflicting blacklist rules for method %v found", )
}
if , := .methods[]; {
return fmt.Errorf("conflicting method rules for method %v found", )
}
if .methods == nil {
.methods = make(map[string]*methodLoggerConfig)
}
.methods[] =
return nil
}
func ( *logger) ( string) error {
if , := .blacklist[]; {
return fmt.Errorf("conflicting blacklist rules for method %v found", )
}
if , := .methods[]; {
return fmt.Errorf("conflicting method rules for method %v found", )
}
if .blacklist == nil {
.blacklist = make(map[string]struct{})
}
.blacklist[] = struct{}{}
return nil
}
func ( *logger) ( string) *MethodLogger {
, , := grpcutil.ParseMethod()
if != nil {
grpclogLogger.Infof("binarylogging: failed to parse %q: %v", , )
return nil
}
if , := .methods[+"/"+]; {
return newMethodLogger(.hdr, .msg)
}
if , := .blacklist[+"/"+]; {
return nil
}
if , := .services[]; {
return newMethodLogger(.hdr, .msg)
}
if .all == nil {
return nil
}
return newMethodLogger(.all.hdr, .all.msg)
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |