qlog: rename DefaultTracer to DefaultConnectionTracer (#4556)

This commit is contained in:
Marten Seemann
2024-06-05 18:50:01 +08:00
committed by GitHub
parent 91221b4a05
commit cc9a5ee744
5 changed files with 13 additions and 7 deletions

View File

@@ -13,9 +13,15 @@ import (
)
// DefaultTracer creates a qlog file in the qlog directory specified by the QLOGDIR environment variable.
// Deprecated: use DefaultConnectionTracer instead.
func DefaultTracer(ctx context.Context, p logging.Perspective, connID logging.ConnectionID) *logging.ConnectionTracer {
return DefaultConnectionTracer(ctx, p, connID)
}
// DefaultConnectionTracer creates a qlog file in the qlog directory specified by the QLOGDIR environment variable.
// File names are <odcid>_<perspective>.qlog.
// Returns nil if QLOGDIR is not set.
func DefaultTracer(_ context.Context, p logging.Perspective, connID logging.ConnectionID) *logging.ConnectionTracer {
func DefaultConnectionTracer(_ context.Context, p logging.Perspective, connID logging.ConnectionID) *logging.ConnectionTracer {
var label string
switch p {
case logging.PerspectiveClient:

View File

@@ -36,7 +36,7 @@ var _ = Describe("qlog dir tests", Serial, func() {
qlogDir := path.Join(tempTestDirPath, "qlogs")
err := os.Setenv("QLOGDIR", qlogDir)
Expect(err).ToNot(HaveOccurred())
tracer := DefaultTracer(ctx, perspective, connID)
tracer := DefaultConnectionTracer(ctx, perspective, connID)
Expect(tracer).ToNot(BeNil())
tracer.Close()
_, err = os.Stat(qlogDir)
@@ -50,7 +50,7 @@ var _ = Describe("qlog dir tests", Serial, func() {
It("environment variable is not set", func() {
err := os.Setenv("QLOGDIR", "")
Expect(err).ToNot(HaveOccurred())
tracer := DefaultTracer(ctx, perspective, connID)
tracer := DefaultConnectionTracer(ctx, perspective, connID)
Expect(tracer).To(BeNil())
})
})