forked from quic-go/quic-go
simplify the Tracer interface by combining the TracerFor... methods
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/logging"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
)
|
||||
|
||||
@@ -25,7 +27,7 @@ func GetSSLKeyLog() (io.WriteCloser, error) {
|
||||
}
|
||||
|
||||
// GetQLOGWriter creates the QLOGDIR and returns the GetLogWriter callback
|
||||
func GetQLOGWriter() (func(connID []byte) io.WriteCloser, error) {
|
||||
func GetQLOGWriter() (func(perspective logging.Perspective, connID []byte) io.WriteCloser, error) {
|
||||
qlogDir := os.Getenv("QLOGDIR")
|
||||
if len(qlogDir) == 0 {
|
||||
return nil, nil
|
||||
@@ -35,7 +37,7 @@ func GetQLOGWriter() (func(connID []byte) io.WriteCloser, error) {
|
||||
return nil, fmt.Errorf("failed to create qlog dir %s: %s", qlogDir, err.Error())
|
||||
}
|
||||
}
|
||||
return func(connID []byte) io.WriteCloser {
|
||||
return func(_ logging.Perspective, connID []byte) io.WriteCloser {
|
||||
path := fmt.Sprintf("%s/%x.qlog", strings.TrimRight(qlogDir, "/"), connID)
|
||||
f, err := os.Create(path)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user