logger = log.Default
}
if cl.config.Debug {
- logger = logger.FilterLevel(log.Debug)
+ logger = logger.WithFilterLevel(log.Debug)
}
cl.logger = logger.WithValues(cl)
}
func dialFromSocket(ctx context.Context, s Dialer, addr string) net.Conn {
c, err := s.Dial(ctx, addr)
if err != nil {
- log.Levelf(log.Debug, "error dialing %q: %v", addr, err)
+ log.ContextLogger(ctx).Levelf(log.Debug, "error dialing %q: %v", addr, err)
}
// This is a bit optimistic, but it looks non-trivial to thread this through the proxy code. Set
// it now in case we close the connection forthwith. Note this is also done in the TCP dialer
cfg.ListenPort = 0
cfg.KeepAliveTimeout = time.Millisecond
cfg.MinPeerExtensions.SetBit(pp.ExtensionBitFast, true)
- cfg.Logger = log.Default.WithContextText(t.Name())
+ cfg.Logger = log.Default.WithNames(t.Name())
// 2 would suffice for the greeting test, but 5 is needed for a few other tests. This should be
// something slightly higher than the usual chunk size, so it gets tickled in some tests.
cfg.MaxAllocPeerRequestDataPerConn = 5