simplify the Tracer interface by combining the TracerFor... methods

This commit is contained in:
Marten Seemann 2020-07-11 10:46:35 +07:00
parent ece3592544
commit ee24d3899e
32 changed files with 139 additions and 194 deletions

View file

@ -22,20 +22,10 @@ func NewMultiplexedTracer(tracers ...Tracer) Tracer {
return &tracerMultiplexer{tracers}
}
func (m *tracerMultiplexer) TracerForServer(odcid ConnectionID) ConnectionTracer {
func (m *tracerMultiplexer) TracerForConnection(p Perspective, odcid ConnectionID) ConnectionTracer {
var connTracers []ConnectionTracer
for _, t := range m.tracers {
if ct := t.TracerForServer(odcid); ct != nil {
connTracers = append(connTracers, ct)
}
}
return newConnectionMultiplexer(connTracers...)
}
func (m *tracerMultiplexer) TracerForClient(odcid ConnectionID) ConnectionTracer {
var connTracers []ConnectionTracer
for _, t := range m.tracers {
if ct := t.TracerForClient(odcid); ct != nil {
if ct := t.TracerForConnection(p, odcid); ct != nil {
connTracers = append(connTracers, ct)
}
}