github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/libkbfs/trace_logger.go (about)

     1  // Copyright 2017 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package libkbfs
     6  
     7  import (
     8  	"context"
     9  
    10  	"github.com/keybase/client/go/logger"
    11  	"golang.org/x/net/trace"
    12  )
    13  
    14  type traceLogger struct {
    15  	logger.Logger
    16  }
    17  
    18  // TODO: Override logger.Logger functions to trace log statements if
    19  // the right options are turned on.
    20  
    21  func (tl traceLogger) LazyTrace(
    22  	ctx context.Context, format string, args ...interface{}) {
    23  	if tr, ok := trace.FromContext(ctx); ok {
    24  		tr.LazyPrintf(format, args...)
    25  	}
    26  }