forked from quic-go/quic-go
qlog: split serializiation and event definitions, remove logging abstraction (#5356)
* qlog: implement a Trace and a Writer struct * qlog: rename Trace to FileSeq * split qlog trace writer and QUIC qlog events into separate packages * use the new qlog.Recorder instead of the logging.ConnectionTracer
This commit is contained in:
@@ -11,8 +11,7 @@ import (
|
||||
|
||||
"github.com/quic-go/quic-go"
|
||||
"github.com/quic-go/quic-go/internal/utils"
|
||||
"github.com/quic-go/quic-go/logging"
|
||||
"github.com/quic-go/quic-go/qlog"
|
||||
"github.com/quic-go/quic-go/qlogwriter"
|
||||
)
|
||||
|
||||
// GetSSLKeyLog creates a file for the TLS key log
|
||||
@@ -29,7 +28,7 @@ func GetSSLKeyLog() (io.WriteCloser, error) {
|
||||
}
|
||||
|
||||
// NewQLOGConnectionTracer create a qlog file in QLOGDIR
|
||||
func NewQLOGConnectionTracer(_ context.Context, p logging.Perspective, connID quic.ConnectionID) *logging.ConnectionTracer {
|
||||
func NewQLOGConnectionTracer(_ context.Context, isClient bool, connID quic.ConnectionID) qlogwriter.Trace {
|
||||
qlogDir := os.Getenv("QLOGDIR")
|
||||
if len(qlogDir) == 0 {
|
||||
return nil
|
||||
@@ -46,5 +45,7 @@ func NewQLOGConnectionTracer(_ context.Context, p logging.Perspective, connID qu
|
||||
return nil
|
||||
}
|
||||
log.Printf("Created qlog file: %s\n", path)
|
||||
return qlog.NewConnectionTracer(utils.NewBufferedWriteCloser(bufio.NewWriter(f), f), p, connID)
|
||||
fileSeq := qlogwriter.NewConnectionFileSeq(utils.NewBufferedWriteCloser(bufio.NewWriter(f), f), isClient, connID)
|
||||
go fileSeq.Run()
|
||||
return fileSeq
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user