expose the constructor for the qlog connection tracer

This commit is contained in:
Marten Seemann
2021-02-09 10:51:21 +08:00
parent 622ca23d4e
commit ef1cea84c4
2 changed files with 4 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ func NewTracer(getLogWriter func(p logging.Perspective, connectionID []byte) io.
func (t *tracer) TracerForConnection(p logging.Perspective, odcid protocol.ConnectionID) logging.ConnectionTracer {
if w := t.getLogWriter(p, odcid.Bytes()); w != nil {
return newConnectionTracer(w, p, odcid)
return NewConnectionTracer(w, p, odcid)
}
return nil
}
@@ -58,8 +58,8 @@ type connectionTracer struct {
var _ logging.ConnectionTracer = &connectionTracer{}
// newTracer creates a new connectionTracer to record a qlog.
func newConnectionTracer(w io.WriteCloser, p protocol.Perspective, odcid protocol.ConnectionID) logging.ConnectionTracer {
// NewConnectionTracer creates a new tracer to record a qlog for a connection.
func NewConnectionTracer(w io.WriteCloser, p protocol.Perspective, odcid protocol.ConnectionID) logging.ConnectionTracer {
t := &connectionTracer{
w: w,
perspective: p,

View File

@@ -58,7 +58,7 @@ var _ = Describe("Tracing", func() {
It("stops writing when encountering an error", func() {
buf := &bytes.Buffer{}
t := newConnectionTracer(
t := NewConnectionTracer(
&limitedWriter{WriteCloser: nopWriteCloser(buf), N: 250},
protocol.PerspectiveServer,
protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},